Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cactus.internal
Class BaseWebRequest

    java.lang.Object
      org.apache.cactus.internal.BaseWebRequest

All Implemented Interfaces:
  Request, WebRequest

Direct Known Subclasses:
  WebRequestImpl

public abstract class BaseWebRequest
extends java.lang.Object
implements WebRequest

Contains all HTTP request data for a test case but independently of the fact that there is or there is not a Cactus redirector. It is the data that will be sent to the server side.

Version:
  $Id: BaseWebRequest.java 238991 2004-05-22 11:34:50Z vmassol $

Field Summary

Fields inherited from interface org.apache.cactus.WebRequest
`GET_METHOD, POST_METHOD`

Constructor Summary
`BaseWebRequest()` Default constructor that requires that `setConfiguration(Configuration)` be called before the methods requiring a configuration object.
`BaseWebRequest(Configuration theConfiguration)`

Method Summary
`void` | `addCookie(Cookie theCookie)` Adds a cookie to the request.
`void` | `addCookie(java.lang.String theName, java.lang.String theValue)` Adds a cookie to the request.
`void` | `addCookie(java.lang.String theDomain, java.lang.String theName, java.lang.String theValue)` Adds a cookie to the request.
`void` | `addHeader(java.lang.String theName, java.lang.String theValue)` Adds a header to the request.
`void` | `addParameter(java.lang.String theName, java.lang.String theValue)` Adds a parameter to the request.
`void` | `addParameter(java.lang.String theName, java.lang.String theValue, java.lang.String theMethod)` Adds a parameter to the request.
`Authentication` | `getAuthentication()`
`protected Configuration` | `getConfiguration()`
`java.lang.String` | `getContentType()`
`java.util.Vector` | `getCookies()`
`java.lang.String` | `getHeader(java.lang.String theName)` Returns the first value corresponding to this header's name.
`java.util.Enumeration` | `getHeaderNames()`
`java.lang.String[]` | `getHeaderValues(java.lang.String theName)` Returns all the values associated with this header's name.
`java.lang.String` | `getParameterGet(java.lang.String theName)` Returns the first value corresponding to this parameter's name (provided this parameter is passed in the URL).
`java.util.Enumeration` | `getParameterNamesGet()`
`java.util.Enumeration` | `getParameterNamesPost()`
`java.lang.String` | `getParameterPost(java.lang.String theName)` Returns the first value corresponding to this parameter's name (provided this parameter is passed in the request body - POST).
`java.lang.String[]` | `getParameterValuesGet(java.lang.String theName)` Returns all the values corresponding to this parameter's name (provided this parameter is passed in the URL).
`java.lang.String[]` | `getParameterValuesPost(java.lang.String theName)` Returns all the values corresponding to this parameter's name (provided this parameter is passed in the request body - POST).
`java.io.InputStream` | `getUserData()`
`void` | `setAuthentication(Authentication theAuthentication)` Sets the authentication object that will configure the http request
`void` | `setConfiguration(Configuration theConfiguration)`
`void` | `setContentType(java.lang.String theContentType)` Sets the content type that will be set in the http request
`void` | `setUserData(java.io.InputStream theDataStream)` Allow the user to send arbitrary data in the request body
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.apache.cactus.WebRequest
`getAutomaticSession, getRedirectorName, getSessionCookie, getURL, setAutomaticSession, setRedirectorName, setURL`

Constructor Detail

### BaseWebRequest

    public BaseWebRequest()

  Default constructor that requires that `setConfiguration(Configuration)` be called before the methods requiring a configuration object.

### BaseWebRequest

    public BaseWebRequest(Configuration theConfiguration)

Parameters:
  `theConfiguration` - the Cactus configuration

Method Detail

### getConfiguration

    protected Configuration getConfiguration()

  Returns:
    the Cactus configuration

### setConfiguration

    public void setConfiguration(Configuration theConfiguration)

  Parameters:
    `theConfiguration` - the cactus configuration to assign to this request

### setContentType

    public void setContentType(java.lang.String theContentType)

  Description copied from interface: `WebRequest`
  Sets the content type that will be set in the http request

  Specified by:
    `setContentType` in interface `WebRequest`
  Parameters:
    `theContentType` - the content type
  See Also:
    `WebRequest.setContentType(String)`

### getContentType

    public java.lang.String getContentType()

  Specified by:
    `getContentType` in interface `WebRequest`
  Returns:
    the content type that will be set in the http request
  See Also:
    `WebRequest.getContentType()`

### setUserData

    public void setUserData(java.io.InputStream theDataStream)

  Description copied from interface: `WebRequest`
  Allow the user to send arbitrary data in the request body

  Specified by:
    `setUserData` in interface `WebRequest`
  Parameters:
    `theDataStream` - the stream on which the data are put by the user
  See Also:
    `WebRequest.setUserData(InputStream)`

### getUserData

    public java.io.InputStream getUserData()

  Specified by:
    `getUserData` in interface `WebRequest`
  Returns:
    the data stream set up by the user
  See Also:
    `WebRequest.getUserData()`

### addParameter

    public void addParameter(java.lang.String theName,
                             java.lang.String theValue,
                             java.lang.String theMethod)

  Description copied from interface: `WebRequest`
  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`).

  Specified by:
    `addParameter` in interface `WebRequest`
  Parameters:
    `theName` - the parameter's name
    `theValue` - the parameter's value
    `theMethod` - GET_METHOD or POST_METHOD. If GET_METHOD then the parameter will be sent in the query string of the URL. If POST_METHOD, it will be sent as a parameter in the request body.
  See Also:
    `WebRequest.addParameter(String, String, String)`

### addParameter

    public void addParameter(java.lang.String theName,
                             java.lang.String theValue)

  Description copied from interface: `WebRequest`
  Adds a parameter to the request. The parameter is added to the query string of the URL.

  Specified by:
    `addParameter` in interface `WebRequest`
  Parameters:
    `theName` - the parameter's name
    `theValue` - the parameter's value
  See Also:
    `WebRequest.addParameter(String, String)`

### getParameterNamesPost

    public java.util.Enumeration getParameterNamesPost()

  Specified by:
    `getParameterNamesPost` in interface `WebRequest`
  Returns:
    the parameter names that will be passed in the request body (POST)
  See Also:
    `WebRequest.getParameterNamesPost()`

### getParameterNamesGet

    public java.util.Enumeration getParameterNamesGet()

  Specified by:
    `getParameterNamesGet` in interface `WebRequest`
  Returns:
    the parameter names that will be passed in the URL (GET)
  See Also:
    `WebRequest.getParameterNamesGet()`

### getParameterGet

    public java.lang.String getParameterGet(java.lang.String theName)

  Description copied from interface: `WebRequest`
  Returns the first value corresponding to this parameter's name (provided this parameter is passed in the URL).

  Specified by:
    `getParameterGet` in interface `WebRequest`
  Parameters:
    `theName` - the parameter's name
  Returns:
    the first value corresponding to this parameter's name or null if not found in the list of parameters to be sent in the URL
  See Also:
    `WebRequest.getParameterGet(String)`

### getParameterPost

    public java.lang.String getParameterPost(java.lang.String theName)

  Description copied from interface: `WebRequest`
  Returns the first value corresponding to this parameter's name (provided this parameter is passed in the request body - POST).

  Specified by:
    `getParameterPost` in interface `WebRequest`
  Parameters:
    `theName` - the parameter's name
  Returns:
    the first value corresponding to this parameter's name or null if not found in the list of parameters to be sent in the request body
  See Also:
    `WebRequest.getParameterPost(String)`

### getParameterValuesGet

    public java.lang.String[] getParameterValuesGet(java.lang.String theName)

  Description copied from interface: `WebRequest`
  Returns all the values corresponding to this parameter's name (provided this parameter is passed in the URL).

  Specified by:
    `getParameterValuesGet` in interface `WebRequest`
  Parameters:
    `theName` - the parameter's name
  Returns:
    the first value corresponding to this parameter's name or null if not found in the list of parameters to be sent in the URL
  See Also:
    `WebRequest.getParameterValuesGet(String)`

### getParameterValuesPost

    public java.lang.String[] getParameterValuesPost(java.lang.String theName)

  Description copied from interface: `WebRequest`
  Returns all the values corresponding to this parameter's name (provided this parameter is passed in the request body - POST).

  Specified by:
    `getParameterValuesPost` in interface `WebRequest`
  Parameters:
    `theName` - the parameter's name
  Returns:
    the first value corresponding to this parameter's name or null if not found in the list of parameters to be sent in the request body
  See Also:
    `WebRequest.getParameterValuesPost(String)`

### addCookie

    public void addCookie(java.lang.String theName,
                          java.lang.String theValue)

  Description copied from interface: `WebRequest`
  Adds a cookie to the request. The cookie will be created with a default localhost domain. If you need to specify a domain for the cookie, use the `WebRequest.addCookie(String, String, String)` method or the method `WebRequest.addCookie(Cookie)`.

  Specified by:
    `addCookie` in interface `WebRequest`
  Parameters:
    `theName` - the cookie's name
    `theValue` - the cookie's value
  See Also:
    `WebRequest.addCookie(String, String)`

### addCookie

    public void addCookie(java.lang.String theDomain,
                          java.lang.String theName,
                          java.lang.String theValue)

  Description copied from interface: `WebRequest`
  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()`.

  Specified by:
    `addCookie` in interface `WebRequest`
  Parameters:
    `theDomain` - the cookie domain
    `theName` - the cookie name
    `theValue` - the cookie value
  See Also:
    `WebRequest.addCookie(String, String, String)`

### addCookie

    public void addCookie(Cookie theCookie)

  Description copied from interface: `WebRequest`
  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()`.

  Specified by:
    `addCookie` in interface `WebRequest`
  Parameters:
    `theCookie` - the cookie to add
  See Also:
    `WebRequest.addCookie(Cookie)`

### getCookies

    public java.util.Vector getCookies()

  Specified by:
    `getCookies` in interface `WebRequest`
  Returns:
    the cookies (vector of `Cookie` objects)
  See Also:
    `WebRequest.getCookies()`

### addHeader

    public void addHeader(java.lang.String theName,
                          java.lang.String theValue)

  Description copied from interface: `WebRequest`
  Adds a header to the request. Supports adding several values for the same header name.

  Specified by:
    `addHeader` in interface `WebRequest`
  Parameters:
    `theName` - the header's name
    `theValue` - the header's value
  See Also:
    `WebRequest.addHeader(String, String)`

### getHeaderNames

    public java.util.Enumeration getHeaderNames()

  Specified by:
    `getHeaderNames` in interface `WebRequest`
  Returns:
    the header names
  See Also:
    `WebRequest.getHeaderNames()`

### getHeader

    public java.lang.String getHeader(java.lang.String theName)

  Description copied from interface: `WebRequest`
  Returns the first value corresponding to this header's name.

  Specified by:
    `getHeader` in interface `WebRequest`
  Parameters:
    `theName` - the header's name
  Returns:
    the first value corresponding to this header's name or null if not found
  See Also:
    `WebRequest.getHeader(String)`

### getHeaderValues

    public java.lang.String[] getHeaderValues(java.lang.String theName)

  Description copied from interface: `WebRequest`
  Returns all the values associated with this header's name.

  Specified by:
    `getHeaderValues` in interface `WebRequest`
  Parameters:
    `theName` - the header's name
  Returns:
    the values corresponding to this header's name or null if not found
  See Also:
    `WebRequest.getHeaderValues(String)`

### toString

    public java.lang.String toString()

  Returns:
    a string representation of the request

### setAuthentication

    public void setAuthentication(Authentication theAuthentication)

  Description copied from interface: `WebRequest`
  Sets the authentication object that will configure the http request

  Specified by:
    `setAuthentication` in interface `WebRequest`
  Parameters:
    `theAuthentication` - the authentication object
  See Also:
    `WebRequest.setAuthentication(Authentication)`

### getAuthentication

    public Authentication getAuthentication()

  Specified by:
    `getAuthentication` in interface `WebRequest`
  Returns:
    the authentication that will configure the http request
  See Also:
    `WebRequest.getAuthentication()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.