1 17 package javax.servlet; 18 19 import java.io.BufferedReader ; 20 import java.io.IOException ; 21 import java.util.Enumeration ; 22 import java.util.Locale ; 23 import java.util.Map ; 24 25 26 27 40 41 public class ServletRequestWrapper implements ServletRequest { 42 private ServletRequest request; 43 44 48 49 public ServletRequestWrapper(ServletRequest request) { 50 if (request == null) { 51 throw new IllegalArgumentException ("Request cannot be null"); 52 } 53 this.request = request; 54 } 55 56 59 public ServletRequest getRequest() { 60 return this.request; 61 } 62 63 67 68 public void setRequest(ServletRequest request) { 69 if (request == null) { 70 throw new IllegalArgumentException ("Request cannot be null"); 71 } 72 this.request = request; 73 } 74 75 80 81 public Object getAttribute(String name) { 82 return this.request.getAttribute(name); 83 } 84 85 86 87 91 92 public Enumeration getAttributeNames() { 93 return this.request.getAttributeNames(); 94 } 95 96 97 98 102 103 public String getCharacterEncoding() { 104 return this.request.getCharacterEncoding(); 105 } 106 107 111 112 public void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException { 113 this.request.setCharacterEncoding(enc); 114 } 115 116 117 121 122 public int getContentLength() { 123 return this.request.getContentLength(); 124 } 125 126 127 128 129 133 public String getContentType() { 134 return this.request.getContentType(); 135 } 136 137 138 139 140 144 145 public ServletInputStream getInputStream() throws IOException { 146 return this.request.getInputStream(); 147 } 148 149 150 151 152 156 157 public String getParameter(String name) { 158 return this.request.getParameter(name); 159 } 160 161 165 public Map getParameterMap() { 166 return this.request.getParameterMap(); 167 } 168 169 170 171 172 176 177 public Enumeration getParameterNames() { 178 return this.request.getParameterNames(); 179 } 180 181 182 183 184 188 public String [] getParameterValues(String name) { 189 return this.request.getParameterValues(name); 190 } 191 192 193 194 195 199 200 public String getProtocol() { 201 return this.request.getProtocol(); 202 } 203 204 205 206 207 211 212 213 public String getScheme() { 214 return this.request.getScheme(); 215 } 216 217 218 219 220 224 public String getServerName() { 225 return this.request.getServerName(); 226 } 227 228 229 230 231 235 236 public int getServerPort() { 237 return this.request.getServerPort(); 238 } 239 240 241 242 246 247 public BufferedReader getReader() throws IOException { 248 return this.request.getReader(); 249 } 250 251 252 253 254 258 259 public String getRemoteAddr() { 260 return this.request.getRemoteAddr(); 261 } 262 263 264 265 266 270 271 public String getRemoteHost() { 272 return this.request.getRemoteHost(); 273 } 274 275 276 277 278 282 283 public void setAttribute(String name, Object o) { 284 this.request.setAttribute(name, o); 285 } 286 287 288 289 290 294 public void removeAttribute(String name) { 295 this.request.removeAttribute(name); 296 } 297 298 299 300 301 305 306 public Locale getLocale() { 307 return this.request.getLocale(); 308 } 309 310 311 312 313 317 318 public Enumeration getLocales() { 319 return this.request.getLocales(); 320 } 321 322 323 324 325 329 330 public boolean isSecure() { 331 return this.request.isSecure(); 332 } 333 334 335 336 337 341 342 public RequestDispatcher getRequestDispatcher(String path) { 343 return this.request.getRequestDispatcher(path); 344 } 345 346 347 348 349 353 354 public String getRealPath(String path) { 355 return this.request.getRealPath(path); 356 } 357 358 364 public int getRemotePort(){ 365 return this.request.getRemotePort(); 366 } 367 368 369 375 public String getLocalName(){ 376 return this.request.getLocalName(); 377 } 378 379 385 public String getLocalAddr(){ 386 return this.request.getLocalAddr(); 387 } 388 389 390 396 public int getLocalPort(){ 397 return this.request.getLocalPort(); 398 } 399 400 } 401 402 | Popular Tags |