Home » cactus-1.8.1-src » org.apache » cactus » [javadoc | source]
org.apache.cactus
public interface: WebRequest [javadoc | source]

All Implemented Interfaces:
    Request

All Known Implementing Classes:
    WebRequestImpl, BaseWebRequest

Contains HTTP request data for a Cactus test case.
Field Summary
 String GET_METHOD    GET Method identifier. 
 String POST_METHOD    POST Method identifier. 
Method from org.apache.cactus.WebRequest Summary:
addCookie,   addCookie,   addCookie,   addHeader,   addParameter,   addParameter,   getAuthentication,   getAutomaticSession,   getContentType,   getCookies,   getHeader,   getHeaderNames,   getHeaderValues,   getParameterGet,   getParameterNamesGet,   getParameterNamesPost,   getParameterPost,   getParameterValuesGet,   getParameterValuesPost,   getRedirectorName,   getSessionCookie,   getURL,   getUserData,   setAuthentication,   setAutomaticSession,   setContentType,   setRedirectorName,   setURL,   setUserData
Method from org.apache.cactus.WebRequest Detail:
 public  void addCookie(Cookie theCookie)
    Adds a cookie to the request. Note that the domain must match either the redirector host (specified in cactus.properties) or the host set using setURL().
 public  void addCookie(String theName,
    String theValue)
 public  void addCookie(String theDomain,
    String theName,
    String theValue)
    Adds a cookie to the request. The cookie will be created with the domain passed as parameter (i.e. the cookie will get sent only to requests to that domain). Note that the domain must match either the redirector host (specified in cactus.properties) or the host set using setURL().
 public  void addHeader(String theName,
    String theValue)
    Adds a header to the request. Supports adding several values for the same header name.
 public  void addParameter(String theName,
    String theValue)
    Adds a parameter to the request. The parameter is added to the query string of the URL.
 public  void addParameter(String theName,
    String theValue,
    String theMethod)
    Adds a parameter to the request. It is possible to add several times the the same parameter name, but with different value (the same as for the HttpServletRequest).
 public Authentication getAuthentication()
 public boolean getAutomaticSession()
 public String getContentType()
 public Vector getCookies()
 public String getHeader(String theName)
    Returns the first value corresponding to this header's name.
 public Enumeration getHeaderNames()
 public String[] getHeaderValues(String theName)
    Returns all the values associated with this header's name.
 public String getParameterGet(String theName)
    Returns the first value corresponding to this parameter's name (provided this parameter is passed in the URL).
 public Enumeration getParameterNamesGet()
 public Enumeration getParameterNamesPost()
 public String getParameterPost(String theName)
    Returns the first value corresponding to this parameter's name (provided this parameter is passed in the request body - POST).
 public String[] getParameterValuesGet(String theName)
    Returns all the values corresponding to this parameter's name (provided this parameter is passed in the URL).
 public String[] getParameterValuesPost(String theName)
    Returns all the values corresponding to this parameter's name (provided this parameter is passed in the request body - POST).
 public String getRedirectorName()
 public HttpSessionCookie getSessionCookie()
    Gets an HTTP session id by calling the server side and retrieving the jsessionid cookie in the HTTP response. This is achieved by calling the Cactus redirector used by the current test case.
 public ServletURL getURL()
 public InputStream getUserData()
 public  void setAuthentication(Authentication theAuthentication)
    Sets the authentication object that will configure the http request.
 public  void setAutomaticSession(boolean isAutomaticSession)
 public  void setContentType(String theContentType)
    Sets the content type that will be set in the http request.
 public  void setRedirectorName(String theRedirectorName)
    Override the redirector Name defined in cactus.properties. This is useful to define a per test case Name (for example, if some test case need to have authentication turned on and not other tests, etc).
 public  void setURL(String theServerName,
    String theContextPath,
    String theServletPath,
    String thePathInfo,
    String theQueryString)
    Sets the simulated URL. A URL is of the form :
    
    URL = "http://" + serverName (including port) + requestURI ? queryString
    
    requestURI = contextPath + servletPath + pathInfo
    From the Servlet 2.2 specification :
    • Context Path: The path prefix associated with the ServletContext that this servlet is a part of. If this context is the default context rooted at the base of the web server's URL namespace, this path will be an empty string. Otherwise, this path starts with a character but does not end with a character.
    • Servlet Path: The path section that directly corresponds to the mapping which activated this request. This path starts with a character.
    • PathInfo: The part of the request path that is not part of the Context Path or the Servlet Path.
 public  void setUserData(InputStream theDataStream)
    Allow the user to send arbitrary data in the request body.