1 16 17 package org.apache.jetspeed.util.servlet; 18 19 import java.io.IOException ; 20 import java.io.OutputStream ; 21 import java.io.PrintWriter ; 22 import javax.servlet.*; 23 import javax.servlet.http.*; 24 import java.util.Locale ; 25 26 34 public class EcsServletResponse implements HttpServletResponse 35 { 36 37 private HttpServletResponse rsp; 38 39 40 private EcsServletOutputStream sout; 41 42 43 private PrintWriter writer; 44 45 46 private boolean outUsed = false; 47 48 49 private boolean writerUsed = false; 50 51 56 public EcsServletResponse(HttpServletResponse rsp, OutputStream out) { 57 this.rsp = rsp; 58 this.sout = new EcsServletOutputStream(out); 59 } 60 61 64 public String getCharacterEncoding() 65 { 66 return rsp.getCharacterEncoding(); 67 } 68 69 72 public ServletOutputStream getOutputStream() throws IOException 73 { 74 if (writerUsed) 75 { 76 throw new IllegalStateException ("Writer already used"); 77 } 78 79 this.outUsed = true; 80 81 return this.sout; 82 } 83 84 87 public PrintWriter getWriter() throws IOException 88 { 89 if (outUsed) 90 { 91 throw new IllegalStateException ("OutputStream already in use"); 92 } 93 94 if (writer==null) 95 { 96 this.writer = new PrintWriter (this.sout); 97 } 98 99 this.writerUsed = true; 100 101 return writer; 102 } 103 104 107 public void setContentLength(int len) 108 { 109 } 111 112 115 public void setContentType(String type) 116 { 117 } 119 120 123 public void setBufferSize(int size) 124 { 125 } 127 128 131 public int getBufferSize() 132 { 133 return rsp.getBufferSize(); 134 } 135 136 139 public void flushBuffer() throws IOException 140 { 141 this.sout.flush(); 142 } 143 144 147 public boolean isCommitted() 148 { 149 return true; 152 } 153 154 157 public void reset() 158 { 159 } 161 162 165 public void setLocale(Locale loc) 166 { 167 } 169 170 173 public Locale getLocale() 174 { 175 return rsp.getLocale(); 176 } 177 178 181 public void addCookie(Cookie cookie) 182 { 183 rsp.addCookie(cookie); 184 } 185 186 189 public boolean containsHeader(String name) 190 { 191 return rsp.containsHeader(name); 192 } 193 194 197 public String encodeURL(String url) 198 { 199 return rsp.encodeURL(url); 200 } 201 202 205 public String encodeRedirectURL(String url) 206 { 207 return rsp.encodeRedirectURL(url); 208 } 209 210 213 public String encodeUrl(String url) 214 { 215 return rsp.encodeUrl(url); 216 } 217 218 221 public String encodeRedirectUrl(String url) 222 { 223 return rsp.encodeRedirectUrl(url); 224 } 225 226 229 public void sendError(int sc, String msg) throws IOException 230 { 231 } 233 234 237 public void sendError(int sc) throws IOException 238 { 239 } 241 242 245 public void sendRedirect(String location) throws IOException 246 { 247 } 249 250 253 public void setDateHeader(String name, long date) 254 { 255 } 257 258 261 public void addDateHeader(String name, long date) 262 { 263 } 265 266 269 public void setHeader(String name, String value) 270 { 271 } 273 274 277 public void addHeader(String name, String value) 278 { 279 } 281 282 285 public void setIntHeader(String name, int value) 286 { 287 } 289 290 293 public void addIntHeader(String name, int value) 294 { 295 } 297 298 301 public void setStatus(int sc) 302 { 303 } 305 306 309 public void setStatus(int sc, String sm) 310 { 311 } 313 314 public void resetBuffer() 315 { 316 } 319 320 } 321 | Popular Tags |