Abstract wrapper around
HttpServletRequest . This class provides
a common implementation of the wrapper for the different Servlet APIs.
This is an implementation that delegates all the call to the
HttpServletRequest object passed in the constructor except for
some overidden methods which are use to simulate a URL. This is to be able
to simulate any URL that would have been used to call the test method : if
this was not done, the URL that would be returned (by calling the
HttpServletRequest.getRequestURI method or others alike) would be
the URL of the Cactus redirector servlet and not a URL that the test case
want to simulate.
version: $Id: AbstractHttpServletRequestWrapper.java 238993 2004-05-22 16:39:34Z vmassol $
AbstractHttpServletRequestWrapper(HttpServletRequest theRequest, ServletURL theURL) Construct an HttpServletRequest instance that delegates
it's method calls to the request object passed as parameter and that
uses the URL passed as parameter to simulate a URL from which the request
would come from.
Construct an HttpServletRequest instance that delegates
it's method calls to the request object passed as parameter and that
uses the URL passed as parameter to simulate a URL from which the request
would come from.
Parameters: theRequest - the real HTTP request Parameters: theURL - the URL to simulate or null if none
the context path from the simulated URL or the real context pathif a simulation URL has not been defined. The real context pathwill be returned if the context path defined in the simulated URL has a null value.
any extra path information after the servlet name butbefore the query string, and translates it to a real path.Takes into account the simulated URL (if any).
Parameters: thePath - the path to the resource a wrapped request dispatcher instead of the real one, so thatforward() and include() calls will use the wrapped dispatcherpassing it the *original* request [this is needed for someservlet engine like Tomcat 3.x which do not support the newmechanism introduced by Servlet 2.3 Filters]. See Also:HttpServletRequest.getRequestDispatcher(String)
the server name from the simulated URL or the real server nameif a simulation URL has not been defined. If the server namedefined in the simulation URL is null, return the real servername.
the server port number from the simulated URL or the real serverport number if a simulation URL has not been defined. If noport is defined in the simulation URL, then port 80 is returned.If the server name has been defined with a null value inin the simulation URL, return the real server port.
the servlet path from the simulated URL or the real servlet pathif a simulation URL has not been defined. The real servlet pathwill be returned if the servlet path defined in the simulated URL has a null value.
public void setRemoteHostName(String theRemoteHostName)(Code)
Simulates the remote host name(ie the client host name).
Parameters: theRemoteHostName - the simulated host name in string format.Exemple : "atlantis"
setRemoteIPAddress
public void setRemoteIPAddress(String theRemoteIPAddress)(Code)
Simulates the remote IP address (ie the client IP address).
Parameters: theRemoteIPAddress - the simulated IP address in string format.Exemple : "127.0.0.1"
setRemoteUser
public void setRemoteUser(String theRemoteUser)(Code)
Sets the remote user name to simulate.
Parameters: theRemoteUser - the simulated remote user name