Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

servletunit.struts
Class StrutsRequestWrapper  view StrutsRequestWrapper download StrutsRequestWrapper.java

java.lang.Object
  extended byorg.apache.cactus.server.AbstractHttpServletRequestWrapper
      extended byorg.apache.cactus.server.AbstractHttpServletRequestWrapper23
          extended byorg.apache.cactus.server.HttpServletRequestWrapper
              extended byservletunit.struts.StrutsRequestWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class StrutsRequestWrapper
extends org.apache.cactus.server.HttpServletRequestWrapper

A wrapper for the HttpServletRequest class. This is used in CactusStrutsTestCase so that we can add our own request parameters outside of the beginXXX and endXXX methods. This allows us to to use the ActionServlet as a black box, rather than mimic its behavior as was previously the case.


Field Summary
private  java.util.Map parameters
           
private  java.lang.String pathInfo
           
private  java.lang.String servletPath
           
 
Fields inherited from class org.apache.cactus.server.AbstractHttpServletRequestWrapper
remoteHostName, remoteIPAddress, remoteUser, request, url
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
StrutsRequestWrapper(org.apache.cactus.server.HttpServletRequestWrapper request)
           
 
Method Summary
 void addParameter(java.lang.String name, java.lang.String value)
           
 void addParameter(java.lang.String name, java.lang.String[] values)
           
 void clearRequestParameters()
           
 java.lang.String getParameter(java.lang.String name)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 java.util.Map getParameterMap()
          Returns a java.util.Map of the parameters of this request.
 java.util.Enumeration getParameterNames()
          Returns an Enumeration of String objects containing the names of the parameters contained in this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
 java.lang.String getPathInfo()
          Returns any extra path information associated with the URL the client sent when it made this request.
 java.lang.String getServletPath()
          Returns the part of this request's URL that calls the servlet.
 void setPathInfo(java.lang.String pathInfo)
           
 void setServletPath(java.lang.String servletPath)
           
 
Methods inherited from class org.apache.cactus.server.HttpServletRequestWrapper
getLocalAddr, getLocalName, getLocalPort, getRemotePort
 
Methods inherited from class org.apache.cactus.server.AbstractHttpServletRequestWrapper23
getRequestURL, setCharacterEncoding
 
Methods inherited from class org.apache.cactus.server.AbstractHttpServletRequestWrapper
getAttribute, getAttributeNames, getAuthType, getCharacterEncoding, getContentLength, getContentType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getInputStream, getIntHeader, getLocale, getLocales, getMethod, getOriginalRequest, getPathTranslated, getProtocol, getQueryString, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemoteUser, getRequestDispatcher, getRequestedSessionId, getRequestURI, getScheme, getServerName, getServerPort, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isSecure, isUserInRole, removeAttribute, setAttribute, setRemoteHostName, setRemoteIPAddress, setRemoteUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathInfo

private java.lang.String pathInfo

servletPath

private java.lang.String servletPath

parameters

private java.util.Map parameters
Constructor Detail

StrutsRequestWrapper

public StrutsRequestWrapper(org.apache.cactus.server.HttpServletRequestWrapper request)
Method Detail

setPathInfo

public void setPathInfo(java.lang.String pathInfo)

getPathInfo

public java.lang.String getPathInfo()
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character.

This method returns null if there was no extra path information.

Same as the value of the CGI variable PATH_INFO.


setServletPath

public void setServletPath(java.lang.String servletPath)

getServletPath

public java.lang.String getServletPath()
Description copied from interface: javax.servlet.http.HttpServletRequest
Returns the part of this request's URL that calls the servlet. This path starts with a "/" character and includes either the servlet name or a path to the servlet, but does not include any extra path information or a query string. Same as the value of the CGI variable SCRIPT_NAME.

This method will return an empty string ("") if the servlet used to process this request was matched using the "/*" pattern.


getParameter

public java.lang.String getParameter(java.lang.String name)
Description copied from interface: javax.servlet.ServletRequest
Returns the value of a request parameter as a String, or null if the parameter does not exist. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use ServletRequest.getParameterValues(java.lang.String)>ServletRequest.getParameterValues(java.lang.String) 55 .

If you use this method with a multivalued parameter, the value returned is equal to the first value in the array returned by getParameterValues.

If the parameter data was sent in the request body, such as occurs with an HTTP POST request, then reading the body directly via ServletRequest.getInputStream()>ServletRequest.getInputStream() 55 or ServletRequest.getReader()>ServletRequest.getReader() 55 can interfere with the execution of this method.


getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Description copied from interface: javax.servlet.ServletRequest
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.

If the parameter has a single value, the array has a length of 1.


getParameterNames

public java.util.Enumeration getParameterNames()
Description copied from interface: javax.servlet.ServletRequest
Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an empty Enumeration.


addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String[] values)

getParameterMap

public java.util.Map getParameterMap()
Description copied from interface: javax.servlet.ServletRequest
Returns a java.util.Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.


clearRequestParameters

public void clearRequestParameters()