1 17 package javax.servlet; 18 19 import java.io.IOException ; 20 import java.io.PrintWriter ; 21 import java.util.Locale ; 22 23 37 38 39 public class ServletResponseWrapper implements ServletResponse { 40 private ServletResponse response; 41 45 46 47 public ServletResponseWrapper(ServletResponse response) { 48 if (response == null) { 49 throw new IllegalArgumentException ("Response cannot be null"); 50 } 51 this.response = response; 52 } 53 54 57 58 public ServletResponse getResponse() { 59 return this.response; 60 } 61 62 63 67 68 public void setResponse(ServletResponse response) { 69 if (response == null) { 70 throw new IllegalArgumentException ("Response cannot be null"); 71 } 72 this.response = response; 73 } 74 75 81 82 public void setCharacterEncoding(String charset) { 83 this.response.setCharacterEncoding(charset); 84 } 85 86 90 91 public String getCharacterEncoding() { 92 return this.response.getCharacterEncoding(); 93 } 94 95 96 100 101 public ServletOutputStream getOutputStream() throws IOException { 102 return this.response.getOutputStream(); 103 } 104 105 109 110 111 public PrintWriter getWriter() throws IOException { 112 return this.response.getWriter(); 113 } 114 115 119 120 public void setContentLength(int len) { 121 this.response.setContentLength(len); 122 } 123 124 128 129 public void setContentType(String type) { 130 this.response.setContentType(type); 131 } 132 133 139 140 public String getContentType() { 141 return this.response.getContentType(); 142 } 143 144 148 public void setBufferSize(int size) { 149 this.response.setBufferSize(size); 150 } 151 152 156 public int getBufferSize() { 157 return this.response.getBufferSize(); 158 } 159 160 164 165 public void flushBuffer() throws IOException { 166 this.response.flushBuffer(); 167 } 168 169 173 public boolean isCommitted() { 174 return this.response.isCommitted(); 175 } 176 177 181 182 public void reset() { 183 this.response.reset(); 184 } 185 186 190 191 public void resetBuffer() { 192 this.response.resetBuffer(); 193 } 194 195 199 200 public void setLocale(Locale loc) { 201 this.response.setLocale(loc); 202 } 203 204 208 public Locale getLocale() { 209 return this.response.getLocale(); 210 } 211 212 213 } 214 215 216 217 218 219 | Popular Tags |