|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AbstractHttpServletRequestWrapper.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* ====================================================================
|
|
| 3 |
*
|
|
| 4 |
* The Apache Software License, Version 1.1
|
|
| 5 |
*
|
|
| 6 |
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
|
|
| 7 |
* reserved.
|
|
| 8 |
*
|
|
| 9 |
* Redistribution and use in source and binary forms, with or without
|
|
| 10 |
* modification, are permitted provided that the following conditions
|
|
| 11 |
* are met:
|
|
| 12 |
*
|
|
| 13 |
* 1. Redistributions of source code must retain the above copyright
|
|
| 14 |
* notice, this list of conditions and the following disclaimer.
|
|
| 15 |
*
|
|
| 16 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
| 17 |
* notice, this list of conditions and the following disclaimer in
|
|
| 18 |
* the documentation and/or other materials provided with the
|
|
| 19 |
* distribution.
|
|
| 20 |
*
|
|
| 21 |
* 3. The end-user documentation included with the redistribution, if
|
|
| 22 |
* any, must include the following acknowlegement:
|
|
| 23 |
* "This product includes software developed by the
|
|
| 24 |
* Apache Software Foundation (http://www.apache.org/)."
|
|
| 25 |
* Alternately, this acknowlegement may appear in the software itself,
|
|
| 26 |
* if and wherever such third-party acknowlegements normally appear.
|
|
| 27 |
*
|
|
| 28 |
* 4. The names "The Jakarta Project", "Cactus" and "Apache Software
|
|
| 29 |
* Foundation" must not be used to endorse or promote products
|
|
| 30 |
* derived from this software without prior written permission. For
|
|
| 31 |
* written permission, please contact apache@apache.org.
|
|
| 32 |
*
|
|
| 33 |
* 5. Products derived from this software may not be called "Apache"
|
|
| 34 |
* nor may "Apache" appear in their names without prior written
|
|
| 35 |
* permission of the Apache Group.
|
|
| 36 |
*
|
|
| 37 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
| 38 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
| 39 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
| 40 |
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
|
| 41 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
| 42 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
| 43 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
| 44 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
| 45 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
| 46 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
| 47 |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
| 48 |
* SUCH DAMAGE.
|
|
| 49 |
* ====================================================================
|
|
| 50 |
*
|
|
| 51 |
* This software consists of voluntary contributions made by many
|
|
| 52 |
* individuals on behalf of the Apache Software Foundation. For more
|
|
| 53 |
* information on the Apache Software Foundation, please see
|
|
| 54 |
* <http://www.apache.org/>.
|
|
| 55 |
*
|
|
| 56 |
*/
|
|
| 57 |
package org.apache.cactus.server;
|
|
| 58 |
|
|
| 59 |
import java.io.BufferedReader;
|
|
| 60 |
import java.io.File;
|
|
| 61 |
import java.io.IOException;
|
|
| 62 |
|
|
| 63 |
import java.security.Principal;
|
|
| 64 |
|
|
| 65 |
import java.util.Enumeration;
|
|
| 66 |
import java.util.Locale;
|
|
| 67 |
|
|
| 68 |
import javax.servlet.RequestDispatcher;
|
|
| 69 |
import javax.servlet.ServletInputStream;
|
|
| 70 |
import javax.servlet.http.Cookie;
|
|
| 71 |
import javax.servlet.http.HttpServletRequest;
|
|
| 72 |
import javax.servlet.http.HttpSession;
|
|
| 73 |
|
|
| 74 |
import org.apache.cactus.ServletURL;
|
|
| 75 |
import org.apache.commons.logging.Log;
|
|
| 76 |
import org.apache.commons.logging.LogFactory;
|
|
| 77 |
|
|
| 78 |
/**
|
|
| 79 |
* Abstract wrapper around <code>HttpServletRequest</code>. This class provides
|
|
| 80 |
* a common implementation of the wrapper for the different servlet API.
|
|
| 81 |
*
|
|
| 82 |
* @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
|
|
| 83 |
*
|
|
| 84 |
* @version $Id: AbstractHttpServletRequestWrapper.java,v 1.18 2003/06/16 16:41:11 cmlenz Exp $
|
|
| 85 |
*/
|
|
| 86 |
public abstract class AbstractHttpServletRequestWrapper |
|
| 87 |
implements HttpServletRequest
|
|
| 88 |
{
|
|
| 89 |
/**
|
|
| 90 |
* The logger
|
|
| 91 |
*/
|
|
| 92 |
private static final Log LOGGER = |
|
| 93 |
LogFactory.getLog(AbstractHttpServletRequestWrapper.class);
|
|
| 94 |
|
|
| 95 |
/**
|
|
| 96 |
* The real HTTP request
|
|
| 97 |
*/
|
|
| 98 |
protected HttpServletRequest request;
|
|
| 99 |
|
|
| 100 |
/**
|
|
| 101 |
* The URL to simulate
|
|
| 102 |
*/
|
|
| 103 |
protected ServletURL url;
|
|
| 104 |
|
|
| 105 |
/**
|
|
| 106 |
* Remote IP address to simulate (if any)
|
|
| 107 |
* @see #setRemoteIPAddress(String)
|
|
| 108 |
*/
|
|
| 109 |
protected String remoteIPAddress;
|
|
| 110 |
|
|
| 111 |
/**
|
|
| 112 |
* Remote Host name to simulate (if any)
|
|
| 113 |
* @see #setRemoteHostName(String)
|
|
| 114 |
*/
|
|
| 115 |
protected String remoteHostName;
|
|
| 116 |
|
|
| 117 |
/**
|
|
| 118 |
* Remote user to simulate (if any)
|
|
| 119 |
* @see #setRemoteUser(String)
|
|
| 120 |
*/
|
|
| 121 |
protected String remoteUser;
|
|
| 122 |
|
|
| 123 |
// New methods not in the interface --------------------------------------
|
|
| 124 |
|
|
| 125 |
/**
|
|
| 126 |
* Construct an <code>HttpServletRequest</code> instance that delegates
|
|
| 127 |
* it's method calls to the request object passed as parameter and that
|
|
| 128 |
* uses the URL passed as parameter to simulate a URL from which the request
|
|
| 129 |
* would come from.
|
|
| 130 |
*
|
|
| 131 |
* @param theRequest the real HTTP request
|
|
| 132 |
* @param theURL the URL to simulate or <code>null</code> if none
|
|
| 133 |
*/
|
|
| 134 | 0 |
public AbstractHttpServletRequestWrapper(HttpServletRequest theRequest,
|
| 135 |
ServletURL theURL) |
|
| 136 |
{
|
|
| 137 | 0 |
this.request = theRequest;
|
| 138 | 0 |
this.url = theURL;
|
| 139 |
} |
|
| 140 |
|
|
| 141 |
/**
|
|
| 142 |
* @return the original request object
|
|
| 143 |
*/
|
|
| 144 | 0 |
public HttpServletRequest getOriginalRequest()
|
| 145 |
{
|
|
| 146 | 0 |
return this.request; |
| 147 |
} |
|
| 148 |
|
|
| 149 |
/**
|
|
| 150 |
* Simulates the remote IP address (ie the client IP address).
|
|
| 151 |
*
|
|
| 152 |
* @param theRemoteIPAddress the simulated IP address in string format.
|
|
| 153 |
* Exemple : "127.0.0.1"
|
|
| 154 |
*/
|
|
| 155 | 0 |
public void setRemoteIPAddress(String theRemoteIPAddress) |
| 156 |
{
|
|
| 157 | 0 |
this.remoteIPAddress = theRemoteIPAddress;
|
| 158 |
} |
|
| 159 |
|
|
| 160 |
/**
|
|
| 161 |
* Simulates the remote host name(ie the client host name).
|
|
| 162 |
*
|
|
| 163 |
* @param theRemoteHostName the simulated host name in string format.
|
|
| 164 |
* Exemple : "atlantis"
|
|
| 165 |
*/
|
|
| 166 | 0 |
public void setRemoteHostName(String theRemoteHostName) |
| 167 |
{
|
|
| 168 | 0 |
this.remoteHostName = theRemoteHostName;
|
| 169 |
} |
|
| 170 |
|
|
| 171 |
/**
|
|
| 172 |
* Sets the remote user name to simulate.
|
|
| 173 |
*
|
|
| 174 |
* @param theRemoteUser the simulated remote user name
|
|
| 175 |
*/
|
|
| 176 | 0 |
public void setRemoteUser(String theRemoteUser) |
| 177 |
{
|
|
| 178 | 0 |
this.remoteUser = theRemoteUser;
|
| 179 |
} |
|
| 180 |
|
|
| 181 |
// Modified methods ------------------------------------------------------
|
|
| 182 |
|
|
| 183 |
/**
|
|
| 184 |
* @return the context path from the simulated URL or the real context path
|
|
| 185 |
* if a simulation URL has not been defined. The real context path
|
|
| 186 |
* will be returned if the context path defined in the simulated
|
|
| 187 |
* URL has a null value.
|
|
| 188 |
*/
|
|
| 189 | 0 |
public String getContextPath()
|
| 190 |
{
|
|
| 191 | 0 |
String result = this.request.getContextPath();
|
| 192 |
|
|
| 193 | 0 |
if ((this.url != null) && (this.url.getContextPath() != null)) |
| 194 |
{
|
|
| 195 | 0 |
result = this.url.getContextPath();
|
| 196 | 0 |
LOGGER.debug("Using simulated context : [" + result + "]"); |
| 197 |
} |
|
| 198 |
|
|
| 199 | 0 |
return result;
|
| 200 |
} |
|
| 201 |
|
|
| 202 |
/**
|
|
| 203 |
* @return the path info from the simulated URL or the real path info
|
|
| 204 |
* if a simulation URL has not been defined.
|
|
| 205 |
*/
|
|
| 206 | 0 |
public String getPathInfo()
|
| 207 |
{
|
|
| 208 | 0 |
String result; |
| 209 |
|
|
| 210 | 0 |
if (this.url != null) |
| 211 |
{
|
|
| 212 | 0 |
result = this.url.getPathInfo();
|
| 213 | 0 |
LOGGER.debug("Using simulated PathInfo : [" + result + "]"); |
| 214 |
} |
|
| 215 |
else
|
|
| 216 |
{
|
|
| 217 | 0 |
result = this.request.getPathInfo();
|
| 218 |
} |
|
| 219 |
|
|
| 220 | 0 |
return result;
|
| 221 |
} |
|
| 222 |
|
|
| 223 |
/**
|
|
| 224 |
* @return the server name from the simulated URL or the real server name
|
|
| 225 |
* if a simulation URL has not been defined. If the server name
|
|
| 226 |
* defined in the simulation URL is null, return the real server
|
|
| 227 |
* name.
|
|
| 228 |
*/
|
|
| 229 | 0 |
public String getServerName()
|
| 230 |
{
|
|
| 231 | 0 |
String result = this.request.getServerName();
|
| 232 |
|
|
| 233 | 0 |
if ((this.url != null) && (this.url.getHost() != null)) |
| 234 |
{
|
|
| 235 | 0 |
result = this.url.getHost();
|
| 236 | 0 |
LOGGER.debug("Using simulated server name : [" + result + "]"); |
| 237 |
} |
|
| 238 |
|
|
| 239 | 0 |
return result;
|
| 240 |
} |
|
| 241 |
|
|
| 242 |
/**
|
|
| 243 |
* @return the server port number from the simulated URL or the real server
|
|
| 244 |
* port number if a simulation URL has not been defined. If no
|
|
| 245 |
* port is defined in the simulation URL, then port 80 is returned.
|
|
| 246 |
* If the server name has been defined with a null value in
|
|
| 247 |
* in the simulation URL, return the real server port.
|
|
| 248 |
*/
|
|
| 249 | 0 |
public int getServerPort() |
| 250 |
{
|
|
| 251 | 0 |
int result = this.request.getServerPort(); |
| 252 |
|
|
| 253 | 0 |
if ((this.url != null) && (this.url.getServerName() != null)) |
| 254 |
{
|
|
| 255 | 0 |
result = (this.url.getPort() == -1) ? 80 : this.url.getPort(); |
| 256 | 0 |
LOGGER.debug("Using simulated server port : [" + result + "]"); |
| 257 |
} |
|
| 258 |
|
|
| 259 | 0 |
return result;
|
| 260 |
} |
|
| 261 |
|
|
| 262 |
/**
|
|
| 263 |
* @return the URI from the simulated URL or the real URI
|
|
| 264 |
* if a simulation URL has not been defined.
|
|
| 265 |
*/
|
|
| 266 | 0 |
public String getRequestURI()
|
| 267 |
{
|
|
| 268 | 0 |
String result; |
| 269 |
|
|
| 270 | 0 |
if (this.url != null) |
| 271 |
{
|
|
| 272 | 0 |
result = getContextPath() |
| 273 | 0 |
+ ((getServletPath() == null) ? "" : getServletPath()) |
| 274 | 0 |
+ ((getPathInfo() == null) ? "" : getPathInfo()); |
| 275 |
|
|
| 276 | 0 |
LOGGER.debug("Using simulated request URI : [" + result + "]"); |
| 277 |
} |
|
| 278 |
else
|
|
| 279 |
{
|
|
| 280 | 0 |
result = this.request.getRequestURI();
|
| 281 |
} |
|
| 282 |
|
|
| 283 | 0 |
return result;
|
| 284 |
} |
|
| 285 |
|
|
| 286 |
/**
|
|
| 287 |
* @return the servlet path from the simulated URL or the real servlet path
|
|
| 288 |
* if a simulation URL has not been defined. The real servlet path
|
|
| 289 |
* will be returned if the servlet path defined in the simulated
|
|
| 290 |
* URL has a null value.
|
|
| 291 |
*/
|
|
| 292 | 0 |
public String getServletPath()
|
| 293 |
{
|
|
| 294 | 0 |
String result = this.request.getServletPath();
|
| 295 |
|
|
| 296 | 0 |
if ((this.url != null) && (this.url.getServletPath() != null)) |
| 297 |
{
|
|
| 298 | 0 |
result = this.url.getServletPath();
|
| 299 | 0 |
LOGGER.debug("Using simulated servlet path : [" + result + "]"); |
| 300 |
} |
|
| 301 |
|
|
| 302 | 0 |
return result;
|
| 303 |
} |
|
| 304 |
|
|
| 305 |
/**
|
|
| 306 |
* @return any extra path information after the servlet name but
|
|
| 307 |
* before the query string, and translates it to a real path.
|
|
| 308 |
* Takes into account the simulated URL (if any).
|
|
| 309 |
*/
|
|
| 310 | 0 |
public String getPathTranslated()
|
| 311 |
{
|
|
| 312 | 0 |
String pathTranslated; |
| 313 |
|
|
| 314 | 0 |
String pathInfo = this.url.getPathInfo();
|
| 315 |
|
|
| 316 | 0 |
if (pathInfo != null) |
| 317 |
{
|
|
| 318 |
// If getRealPath returns null then getPathTranslated should also
|
|
| 319 |
// return null (see section SRV.4.5 of the Servlet 2.3 spec).
|
|
| 320 | 0 |
if (this.request.getRealPath("/") == null) |
| 321 |
{
|
|
| 322 | 0 |
pathTranslated = null;
|
| 323 |
} |
|
| 324 |
else
|
|
| 325 |
{
|
|
| 326 |
// Compute the translated path using the root real path
|
|
| 327 | 0 |
String newPathInfo = (pathInfo.startsWith("/")
|
| 328 |
? pathInfo.substring(1) : pathInfo); |
|
| 329 |
|
|
| 330 | 0 |
if (this.request.getRealPath("/").endsWith("/")) |
| 331 |
{
|
|
| 332 | 0 |
pathTranslated = this.request.getRealPath("/") |
| 333 |
+ newPathInfo.replace('/', File.separatorChar);
|
|
| 334 |
} |
|
| 335 |
else
|
|
| 336 |
{
|
|
| 337 | 0 |
pathTranslated = this.request.getRealPath("/") |
| 338 |
+ File.separatorChar + newPathInfo.replace('/',
|
|
| 339 |
File.separatorChar); |
|
| 340 |
} |
|
| 341 |
} |
|
| 342 |
} |
|
| 343 |
else
|
|
| 344 |
{
|
|
| 345 | 0 |
pathTranslated = this.request.getPathTranslated();
|
| 346 |
} |
|
| 347 |
|
|
| 348 | 0 |
return pathTranslated;
|
| 349 |
} |
|
| 350 |
|
|
| 351 |
/**
|
|
| 352 |
* @return the query string from the simulated URL or the real query
|
|
| 353 |
* string if a simulation URL has not been defined.
|
|
| 354 |
*/
|
|
| 355 | 0 |
public String getQueryString()
|
| 356 |
{
|
|
| 357 | 0 |
String result; |
| 358 |
|
|
| 359 | 0 |
if (this.url != null) |
| 360 |
{
|
|
| 361 | 0 |
result = this.url.getQueryString();
|
| 362 | 0 |
LOGGER.debug("Using simulated query string : [" + result + "]"); |
| 363 |
} |
|
| 364 |
else
|
|
| 365 |
{
|
|
| 366 | 0 |
result = this.request.getQueryString();
|
| 367 |
} |
|
| 368 |
|
|
| 369 | 0 |
return result;
|
| 370 |
} |
|
| 371 |
|
|
| 372 |
/**
|
|
| 373 |
* @param thePath the path to the resource
|
|
| 374 |
* @return a wrapped request dispatcher instead of the real one, so that
|
|
| 375 |
* forward() and include() calls will use the wrapped dispatcher
|
|
| 376 |
* passing it the *original* request [this is needed for some
|
|
| 377 |
* servlet engine like Tomcat 3.x which do not support the new
|
|
| 378 |
* mechanism introduced by Servlet 2.3 Filters].
|
|
| 379 |
* @see HttpServletRequest#getRequestDispatcher(String)
|
|
| 380 |
*/
|
|
| 381 | 0 |
public RequestDispatcher getRequestDispatcher(String thePath)
|
| 382 |
{
|
|
| 383 |
// I hate it, but we have to write some logic here ! Ideally we
|
|
| 384 |
// shouldn't have to do this as it is supposed to be done by the servlet
|
|
| 385 |
// engine. However as we are simulating the request URL, we have to
|
|
| 386 |
// provide it ... This is where we can see the limitation of Cactus
|
|
| 387 |
// (it has to mock some parts of the servlet engine) !
|
|
| 388 | 0 |
if (thePath == null) |
| 389 |
{
|
|
| 390 | 0 |
return null; |
| 391 |
} |
|
| 392 |
|
|
| 393 | 0 |
RequestDispatcher dispatcher = null;
|
| 394 | 0 |
String fullPath; |
| 395 |
|
|
| 396 |
// The spec says that the path can be relative, in which case it will
|
|
| 397 |
// be relative to the request. So for relative paths, we need to take
|
|
| 398 |
// into account the simulated URL (ServletURL).
|
|
| 399 | 0 |
if (thePath.startsWith("/")) |
| 400 |
{
|
|
| 401 | 0 |
fullPath = thePath; |
| 402 |
} |
|
| 403 |
else
|
|
| 404 |
{
|
|
| 405 | 0 |
String pI = getPathInfo(); |
| 406 |
|
|
| 407 | 0 |
if (pI == null) |
| 408 |
{
|
|
| 409 | 0 |
fullPath = catPath(getServletPath(), thePath); |
| 410 |
} |
|
| 411 |
else
|
|
| 412 |
{
|
|
| 413 | 0 |
fullPath = catPath(getServletPath() + pI, thePath); |
| 414 |
} |
|
| 415 |
|
|
| 416 | 0 |
if (fullPath == null) |
| 417 |
{
|
|
| 418 | 0 |
return null; |
| 419 |
} |
|
| 420 |
} |
|
| 421 |
|
|
| 422 | 0 |
LOGGER.debug("Computed full path : [" + fullPath + "]"); |
| 423 |
|
|
| 424 | 0 |
dispatcher = new RequestDispatcherWrapper(
|
| 425 |
this.request.getRequestDispatcher(fullPath));
|
|
| 426 |
|
|
| 427 | 0 |
return dispatcher;
|
| 428 |
} |
|
| 429 |
|
|
| 430 |
/**
|
|
| 431 |
* Will concatenate 2 paths, normalising it. For example :
|
|
| 432 |
* ( /a/b/c + d = /a/b/d, /a/b/c + ../d = /a/d ). Code borrowed from
|
|
| 433 |
* Tomcat 3.2.2 !
|
|
| 434 |
*
|
|
| 435 |
* @param theLookupPath the first part of the path
|
|
| 436 |
* @param thePath the part to add to the lookup path
|
|
| 437 |
* @return the concatenated thePath or null if an error occurs
|
|
| 438 |
*/
|
|
| 439 | 0 |
private String catPath(String theLookupPath, String thePath)
|
| 440 |
{
|
|
| 441 |
// Cut off the last slash and everything beyond
|
|
| 442 | 0 |
int index = theLookupPath.lastIndexOf("/"); |
| 443 |
|
|
| 444 | 0 |
theLookupPath = theLookupPath.substring(0, index); |
| 445 |
|
|
| 446 |
// Deal with .. by chopping dirs off the lookup thePath
|
|
| 447 | 0 |
while (thePath.startsWith("../")) |
| 448 |
{
|
|
| 449 | 0 |
if (theLookupPath.length() > 0)
|
| 450 |
{
|
|
| 451 | 0 |
index = theLookupPath.lastIndexOf("/");
|
| 452 | 0 |
theLookupPath = theLookupPath.substring(0, index); |
| 453 |
} |
|
| 454 |
else
|
|
| 455 |
{
|
|
| 456 |
// More ..'s than dirs, return null
|
|
| 457 | 0 |
return null; |
| 458 |
} |
|
| 459 |
|
|
| 460 | 0 |
index = thePath.indexOf("../") + 3;
|
| 461 | 0 |
thePath = thePath.substring(index); |
| 462 |
} |
|
| 463 |
|
|
| 464 | 0 |
return theLookupPath + "/" + thePath; |
| 465 |
} |
|
| 466 |
|
|
| 467 |
/**
|
|
| 468 |
* @return the simulated remote IP address if any or the real one.
|
|
| 469 |
*
|
|
| 470 |
* @see HttpServletRequest#getRemoteAddr()
|
|
| 471 |
*/
|
|
| 472 | 0 |
public String getRemoteAddr()
|
| 473 |
{
|
|
| 474 | 0 |
String remoteIPAddress; |
| 475 |
|
|
| 476 | 0 |
if (this.remoteIPAddress != null) |
| 477 |
{
|
|
| 478 | 0 |
remoteIPAddress = this.remoteIPAddress;
|
| 479 |
} |
|
| 480 |
else
|
|
| 481 |
{
|
|
| 482 | 0 |
remoteIPAddress = this.request.getRemoteAddr();
|
| 483 |
} |
|
| 484 |
|
|
| 485 | 0 |
return remoteIPAddress;
|
| 486 |
} |
|
| 487 |
|
|
| 488 |
/**
|
|
| 489 |
* @return the simulated remote host name if any or the real one.
|
|
| 490 |
*
|
|
| 491 |
* @see HttpServletRequest#getRemoteHost()
|
|
| 492 |
*/
|
|
| 493 | 0 |
public String getRemoteHost()
|
| 494 |
{
|
|
| 495 | 0 |
String remoteHostName; |
| 496 |
|
|
| 497 | 0 |
if (this.remoteHostName != null) |
| 498 |
{
|
|
| 499 | 0 |
remoteHostName = this.remoteHostName;
|
| 500 |
} |
|
| 501 |
else
|
|
| 502 |
{
|
|
| 503 | 0 |
remoteHostName = this.request.getRemoteHost();
|
| 504 |
} |
|
| 505 |
|
|
| 506 | 0 |
return remoteHostName;
|
| 507 |
} |
|
| 508 |
|
|
| 509 |
/**
|
|
| 510 |
* @return the simulated remote user name if any or the real one.
|
|
| 511 |
*
|
|
| 512 |
* @see HttpServletRequest#getRemoteUser()
|
|
| 513 |
*/
|
|
| 514 | 0 |
public String getRemoteUser()
|
| 515 |
{
|
|
| 516 | 0 |
String remoteUser; |
| 517 |
|
|
| 518 | 0 |
if (this.remoteUser != null) |
| 519 |
{
|
|
| 520 | 0 |
remoteUser = this.remoteUser;
|
| 521 |
} |
|
| 522 |
else
|
|
| 523 |
{
|
|
| 524 | 0 |
remoteUser = this.request.getRemoteUser();
|
| 525 |
} |
|
| 526 |
|
|
| 527 | 0 |
return remoteUser;
|
| 528 |
} |
|
| 529 |
|
|
| 530 |
// Not modified methods --------------------------------------------------
|
|
| 531 |
|
|
| 532 |
/**
|
|
| 533 |
* @see HttpServletRequest#isRequestedSessionIdFromURL()
|
|
| 534 |
*/
|
|
| 535 | 0 |
public boolean isRequestedSessionIdFromURL() |
| 536 |
{
|
|
| 537 | 0 |
return this.request.isRequestedSessionIdFromURL(); |
| 538 |
} |
|
| 539 |
|
|
| 540 |
/**
|
|
| 541 |
* @see HttpServletRequest#isRequestedSessionIdFromUrl()
|
|
| 542 |
*/
|
|
| 543 | 0 |
public boolean isRequestedSessionIdFromUrl() |
| 544 |
{
|
|
| 545 | 0 |
return this.request.isRequestedSessionIdFromURL(); |
| 546 |
} |
|
| 547 |
|
|
| 548 |
/**
|
|
| 549 |
* @see HttpServletRequest#isUserInRole(String)
|
|
| 550 |
*/
|
|
| 551 | 0 |
public boolean isUserInRole(String theRole) |
| 552 |
{
|
|
| 553 | 0 |
return this.request.isUserInRole(theRole); |
| 554 |
} |
|
| 555 |
|
|
| 556 |
/**
|
|
| 557 |
* @see HttpServletRequest#isRequestedSessionIdValid()
|
|
| 558 |
*/
|
|
| 559 | 0 |
public boolean isRequestedSessionIdValid() |
| 560 |
{
|
|
| 561 | 0 |
return this.request.isRequestedSessionIdValid(); |
| 562 |
} |
|
| 563 |
|
|
| 564 |
/**
|
|
| 565 |
* @see HttpServletRequest#isRequestedSessionIdFromCookie()
|
|
| 566 |
*/
|
|
| 567 | 0 |
public boolean isRequestedSessionIdFromCookie() |
| 568 |
{
|
|
| 569 | 0 |
return this.request.isRequestedSessionIdFromCookie(); |
| 570 |
} |
|
| 571 |
|
|
| 572 |
/**
|
|
| 573 |
* @see HttpServletRequest#getLocales()
|
|
| 574 |
*/
|
|
| 575 | 0 |
public Enumeration getLocales()
|
| 576 |
{
|
|
| 577 | 0 |
return this.request.getLocales(); |
| 578 |
} |
|
| 579 |
|
|
| 580 |
/**
|
|
| 581 |
* @see HttpServletRequest#getHeader(String)
|
|
| 582 |
*/
|
|
| 583 | 0 |
public String getHeader(String theName)
|
| 584 |
{
|
|
| 585 | 0 |
return this.request.getHeader(theName); |
| 586 |
} |
|
| 587 |
|
|
| 588 |
/**
|
|
| 589 |
* @see HttpServletRequest#getHeaders(String)
|
|
| 590 |
*/
|
|
| 591 | 0 |
public Enumeration getHeaders(String theName)
|
| 592 |
{
|
|
| 593 | 0 |
return this.request.getHeaders(theName); |
| 594 |
} |
|
| 595 |
|
|
| 596 |
/**
|
|
| 597 |
* @see HttpServletRequest#getHeaderNames()
|
|
| 598 |
*/
|
|
| 599 | 0 |
public Enumeration getHeaderNames()
|
| 600 |
{
|
|
| 601 | 0 |
return this.request.getHeaderNames(); |
| 602 |
} |
|
| 603 |
|
|
| 604 |
/**
|
|
| 605 |
* @see HttpServletRequest#getScheme()
|
|
| 606 |
*/
|
|
| 607 | 0 |
public String getScheme()
|
| 608 |
{
|
|
| 609 | 0 |
return this.request.getScheme(); |
| 610 |
} |
|
| 611 |
|
|
| 612 |
/**
|
|
| 613 |
* @see HttpServletRequest#getAuthType()
|
|
| 614 |
*/
|
|
| 615 | 0 |
public String getAuthType()
|
| 616 |
{
|
|
| 617 | 0 |
return this.request.getAuthType(); |
| 618 |
} |
|
| 619 |
|
|
| 620 |
/**
|
|
| 621 |
* @see HttpServletRequest#getRealPath(String)
|
|
| 622 |
*/
|
|
| 623 | 0 |
public String getRealPath(String thePath)
|
| 624 |
{
|
|
| 625 | 0 |
return this.request.getRealPath(thePath); |
| 626 |
} |
|
| 627 |
|
|
| 628 |
/**
|
|
| 629 |
* @see HttpServletRequest#getSession()
|
|
| 630 |
*/
|
|
| 631 | 0 |
public HttpSession getSession()
|
| 632 |
{
|
|
| 633 | 0 |
return this.request.getSession(); |
| 634 |
} |
|
| 635 |
|
|
| 636 |
/**
|
|
| 637 |
* @see HttpServletRequest#getSession(boolean)
|
|
| 638 |
*/
|
|
| 639 | 0 |
public HttpSession getSession(boolean isCreate) |
| 640 |
{
|
|
| 641 | 0 |
return this.request.getSession(isCreate); |
| 642 |
} |
|
| 643 |
|
|
| 644 |
/**
|
|
| 645 |
* @see HttpServletRequest#getReader()
|
|
| 646 |
*/
|
|
| 647 | 0 |
public BufferedReader getReader() throws IOException |
| 648 |
{
|
|
| 649 | 0 |
return this.request.getReader(); |
| 650 |
} |
|
| 651 |
|
|
| 652 |
/**
|
|
| 653 |
* @see HttpServletRequest#getContentLength()
|
|
| 654 |
*/
|
|
| 655 | 0 |
public int getContentLength() |
| 656 |
{
|
|
| 657 | 0 |
return this.request.getContentLength(); |
| 658 |
} |
|
| 659 |
|
|
| 660 |
/**
|
|
| 661 |
* @see HttpServletRequest#getParameterValues(String)
|
|
| 662 |
*/
|
|
| 663 | 0 |
public String[] getParameterValues(String theName)
|
| 664 |
{
|
|
| 665 | 0 |
return this.request.getParameterValues(theName); |
| 666 |
} |
|
| 667 |
|
|
| 668 |
/**
|
|
| 669 |
* @see HttpServletRequest#getContentType()
|
|
| 670 |
*/
|
|
| 671 | 0 |
public String getContentType()
|
| 672 |
{
|
|
| 673 | 0 |
return this.request.getContentType(); |
| 674 |
} |
|
| 675 |
|
|
| 676 |
/**
|
|
| 677 |
* @see HttpServletRequest#getLocale()
|
|
| 678 |
*/
|
|
| 679 | 0 |
public Locale getLocale()
|
| 680 |
{
|
|
| 681 | 0 |
return this.request.getLocale(); |
| 682 |
} |
|
| 683 |
|
|
| 684 |
/**
|
|
| 685 |
* @see HttpServletRequest#removeAttribute(String)
|
|
| 686 |
*/
|
|
| 687 | 0 |
public void removeAttribute(String theName) |
| 688 |
{
|
|
| 689 | 0 |
this.request.removeAttribute(theName);
|
| 690 |
} |
|
| 691 |
|
|
| 692 |
/**
|
|
| 693 |
* @see HttpServletRequest#getParameter(String)
|
|
| 694 |
*/
|
|
| 695 | 0 |
public String getParameter(String theName)
|
| 696 |
{
|
|
| 697 | 0 |
return this.request.getParameter(theName); |
| 698 |
} |
|
| 699 |
|
|
| 700 |
/**
|
|
| 701 |
* @see HttpServletRequest#getInputStream()
|
|
| 702 |
*/
|
|
| 703 | 0 |
public ServletInputStream getInputStream() throws IOException |
| 704 |
{
|
|
| 705 | 0 |
return this.request.getInputStream(); |
| 706 |
} |
|
| 707 |
|
|
| 708 |
/**
|
|
| 709 |
* @see HttpServletRequest#getUserPrincipal()
|
|
| 710 |
*/
|
|
| 711 | 0 |
public Principal getUserPrincipal()
|
| 712 |
{
|
|
| 713 | 0 |
return this.request.getUserPrincipal(); |
| 714 |
} |
|
| 715 |
|
|
| 716 |
/**
|
|
| 717 |
* @see HttpServletRequest#isSecure()
|
|
| 718 |
*/
|
|
| 719 | 0 |
public boolean isSecure() |
| 720 |
{
|
|
| 721 | 0 |
return this.request.isSecure(); |
| 722 |
} |
|
| 723 |
|
|
| 724 |
/**
|
|
| 725 |
* @see HttpServletRequest#getCharacterEncoding()
|
|
| 726 |
*/
|
|
| 727 | 0 |
public String getCharacterEncoding()
|
| 728 |
{
|
|
| 729 | 0 |
return this.request.getCharacterEncoding(); |
| 730 |
} |
|
| 731 |
|
|
| 732 |
/**
|
|
| 733 |
* @see HttpServletRequest#getParameterNames()
|
|
| 734 |
*/
|
|
| 735 | 0 |
public Enumeration getParameterNames()
|
| 736 |
{
|
|
| 737 | 0 |
return this.request.getParameterNames(); |
| 738 |
} |
|
| 739 |
|
|
| 740 |
/**
|
|
| 741 |
* @see HttpServletRequest#getMethod()
|
|
| 742 |
*/
|
|
| 743 | 0 |
public String getMethod()
|
| 744 |
{
|
|
| 745 | 0 |
return this.request.getMethod(); |
| 746 |
} |
|
| 747 |
|
|
| 748 |
/**
|
|
| 749 |
* @see HttpServletRequest#setAttribute(String, Object)
|
|
| 750 |
*/
|
|
| 751 | 0 |
public void setAttribute(String theName, Object theAttribute) |
| 752 |
{
|
|
| 753 | 0 |
this.request.setAttribute(theName, theAttribute);
|
| 754 |
} |
|
| 755 |
|
|
| 756 |
/**
|
|
| 757 |
* @see HttpServletRequest#getAttribute(String)
|
|
| 758 |
*/
|
|
| 759 | 0 |
public Object getAttribute(String theName)
|
| 760 |
{
|
|
| 761 | 0 |
return this.request.getAttribute(theName); |
| 762 |
} |
|
| 763 |
|
|
| 764 |
/**
|
|
| 765 |
* @see HttpServletRequest#getIntHeader(String)
|
|
| 766 |
*/
|
|
| 767 | 0 |
public int getIntHeader(String theName) |
| 768 |
{
|
|
| 769 | 0 |
return this.request.getIntHeader(theName); |
| 770 |
} |
|
| 771 |
|
|
| 772 |
/**
|
|
| 773 |
* @see HttpServletRequest#getDateHeader(String)
|
|
| 774 |
*/
|
|
| 775 | 0 |
public long getDateHeader(String theName) |
| 776 |
{
|
|
| 777 | 0 |
return this.request.getDateHeader(theName); |
| 778 |
} |
|
| 779 |
|
|
| 780 |
/**
|
|
| 781 |
* @see HttpServletRequest#getAttributeNames()
|
|
| 782 |
*/
|
|
| 783 | 0 |
public Enumeration getAttributeNames()
|
| 784 |
{
|
|
| 785 | 0 |
return this.request.getAttributeNames(); |
| 786 |
} |
|
| 787 |
|
|
| 788 |
/**
|
|
| 789 |
* @see HttpServletRequest#getRequestedSessionId()
|
|
| 790 |
*/
|
|
| 791 | 0 |
public String getRequestedSessionId()
|
| 792 |
{
|
|
| 793 | 0 |
return this.request.getRequestedSessionId(); |
| 794 |
} |
|
| 795 |
|
|
| 796 |
/**
|
|
| 797 |
* @see HttpServletRequest#getCookies()
|
|
| 798 |
*/
|
|
| 799 | 0 |
public Cookie[] getCookies()
|
| 800 |
{
|
|
| 801 | 0 |
return this.request.getCookies(); |
| 802 |
} |
|
| 803 |
|
|
| 804 |
/**
|
|
| 805 |
* @see HttpServletRequest#getProtocol()
|
|
| 806 |
*/
|
|
| 807 | 0 |
public String getProtocol()
|
| 808 |
{
|
|
| 809 | 0 |
return this.request.getProtocol(); |
| 810 |
} |
|
| 811 |
} |
|
| 812 |
|
|
||||||||||