1 2 3 27 28 29 package org.apache.catalina.connector; 30 31 32 import java.io.IOException ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.ServletOutputStream ; 35 import javax.servlet.http.HttpServletResponse ; 36 import javax.servlet.http.Cookie ; 37 import org.apache.catalina.HttpResponse; 38 39 40 48 49 public final class HttpResponseFacade 50 extends ResponseFacade 51 implements HttpServletResponse { 52 53 54 56 57 62 public HttpResponseFacade(HttpResponse response) { 63 super(response); 64 } 65 66 67 69 70 public void addCookie(Cookie cookie) { 71 72 if (isCommitted()) 73 return; 74 75 ((HttpServletResponse ) response).addCookie(cookie); 76 77 } 78 79 80 public boolean containsHeader(String name) { 81 return ((HttpServletResponse ) response).containsHeader(name); 82 } 83 84 85 public String encodeURL(String url) { 86 return ((HttpServletResponse ) response).encodeURL(url); 87 } 88 89 90 public String encodeRedirectURL(String url) { 91 return ((HttpServletResponse ) response).encodeRedirectURL(url); 92 } 93 94 95 public String encodeUrl(String url) { 96 return ((HttpServletResponse ) response).encodeURL(url); 97 } 98 99 100 public String encodeRedirectUrl(String url) { 101 return ((HttpServletResponse ) response).encodeRedirectURL(url); 102 } 103 104 105 public void sendError(int sc, String msg) 106 throws IOException { 107 108 if (isCommitted()) 109 throw new IllegalStateException 110 (); 111 112 resp.setAppCommitted(true); 113 114 ((HttpServletResponse ) response).sendError(sc, msg); 115 116 } 117 118 119 public void sendError(int sc) 120 throws IOException { 121 122 if (isCommitted()) 123 throw new IllegalStateException 124 (); 125 126 resp.setAppCommitted(true); 127 128 ((HttpServletResponse ) response).sendError(sc); 129 130 } 131 132 133 public void sendRedirect(String location) 134 throws IOException { 135 136 if (isCommitted()) 137 throw new IllegalStateException 138 (); 139 140 resp.setAppCommitted(true); 141 142 ((HttpServletResponse ) response).sendRedirect(location); 143 144 } 145 146 147 public void setDateHeader(String name, long date) { 148 149 if (isCommitted()) 150 return; 151 152 ((HttpServletResponse ) response).setDateHeader(name, date); 153 154 } 155 156 157 public void addDateHeader(String name, long date) { 158 159 if (isCommitted()) 160 return; 161 162 ((HttpServletResponse ) response).addDateHeader(name, date); 163 164 } 165 166 167 public void setHeader(String name, String value) { 168 169 if (isCommitted()) 170 return; 171 172 ((HttpServletResponse ) response).setHeader(name, value); 173 174 } 175 176 177 public void addHeader(String name, String value) { 178 179 if (isCommitted()) 180 return; 181 182 ((HttpServletResponse ) response).addHeader(name, value); 183 184 } 185 186 187 public void setIntHeader(String name, int value) { 188 189 if (isCommitted()) 190 return; 191 192 ((HttpServletResponse ) response).setIntHeader(name, value); 193 194 } 195 196 197 public void addIntHeader(String name, int value) { 198 199 if (isCommitted()) 200 return; 201 202 ((HttpServletResponse ) response).addIntHeader(name, value); 203 204 } 205 206 207 public void setStatus(int sc) { 208 209 if (isCommitted()) 210 return; 211 212 ((HttpServletResponse ) response).setStatus(sc); 213 214 } 215 216 217 public void setStatus(int sc, String sm) { 218 219 if (isCommitted()) 220 return; 221 222 ((HttpServletResponse ) response).setStatus(sc, sm); 223 224 } 225 226 227 } 228 | Popular Tags |