public interface WebRequest extends Request
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
GET_METHOD
GET Method identifier.
|
static java.lang.String |
POST_METHOD
POST Method identifier.
|
Modifier and Type | Method and Description |
---|---|
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() |
boolean |
getAutomaticSession() |
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.lang.String |
getRedirectorName() |
HttpSessionCookie |
getSessionCookie()
Gets an HTTP session id by calling the server side and retrieving
the jsessionid cookie in the HTTP response.
|
ServletURL |
getURL() |
java.io.InputStream |
getUserData() |
void |
setAuthentication(Authentication theAuthentication)
Sets the authentication object that will configure the http request
|
void |
setAutomaticSession(boolean isAutomaticSession) |
void |
setContentType(java.lang.String theContentType)
Sets the content type that will be set in the http request
|
void |
setRedirectorName(java.lang.String theRedirectorName)
Override the redirector Name defined in
cactus.properties . |
void |
setURL(java.lang.String theServerName,
java.lang.String theContextPath,
java.lang.String theServletPath,
java.lang.String thePathInfo,
java.lang.String theQueryString)
Sets the simulated URL.
|
void |
setUserData(java.io.InputStream theDataStream)
Allow the user to send arbitrary data in the request body
|
static final java.lang.String GET_METHOD
static final java.lang.String POST_METHOD
void setContentType(java.lang.String theContentType)
theContentType
- the content typejava.lang.String getContentType()
void setUserData(java.io.InputStream theDataStream)
theDataStream
- the stream on which the data are put by the userjava.io.InputStream getUserData()
void addParameter(java.lang.String theName, java.lang.String theValue, java.lang.String theMethod)
HttpServletRequest
).theName
- the parameter's nametheValue
- the parameter's valuetheMethod
- 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.void addParameter(java.lang.String theName, java.lang.String theValue)
theName
- the parameter's nametheValue
- the parameter's valueaddParameter(String, String, String)
java.util.Enumeration getParameterNamesPost()
java.util.Enumeration getParameterNamesGet()
java.lang.String getParameterGet(java.lang.String theName)
theName
- the parameter's namejava.lang.String getParameterPost(java.lang.String theName)
theName
- the parameter's namejava.lang.String[] getParameterValuesGet(java.lang.String theName)
theName
- the parameter's namejava.lang.String[] getParameterValuesPost(java.lang.String theName)
theName
- the parameter's namevoid addCookie(java.lang.String theName, java.lang.String theValue)
addCookie(String, String, String)
method or the method
addCookie(Cookie)
.theName
- the cookie's nametheValue
- the cookie's valuevoid addCookie(java.lang.String theDomain, java.lang.String theName, java.lang.String theValue)
cactus.properties
) or the host set
using setURL()
.theDomain
- the cookie domaintheName
- the cookie nametheValue
- the cookie valuevoid addCookie(Cookie theCookie)
cactus.properties
) or the host set
using setURL()
.theCookie
- the cookie to addjava.util.Vector getCookies()
Cookie
objects)void addHeader(java.lang.String theName, java.lang.String theValue)
theName
- the header's nametheValue
- the header's valuejava.util.Enumeration getHeaderNames()
java.lang.String getHeader(java.lang.String theName)
theName
- the header's namejava.lang.String[] getHeaderValues(java.lang.String theName)
theName
- the header's namevoid setAuthentication(Authentication theAuthentication)
theAuthentication
- the authentication objectAuthentication getAuthentication()
void setRedirectorName(java.lang.String theRedirectorName)
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).theRedirectorName
- the new redirector Name to usejava.lang.String getRedirectorName()
void setAutomaticSession(boolean isAutomaticSession)
isAutomaticSession
- whether the redirector servlet will
automatically create the HTTP session or not. Default is true.boolean getAutomaticSession()
void setURL(java.lang.String theServerName, java.lang.String theContextPath, java.lang.String theServletPath, java.lang.String thePathInfo, java.lang.String theQueryString)
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.
theServerName
- the server name (and port) in the URL to simulate,
i.e. this is the name that will be returned by the
HttpServletRequest.getServerName()
and
HttpServletRequest.getServerPort()
.theContextPath
- the webapp context path in the URL to simulate,
i.e. this is the name that will be returned by the
HttpServletRequest.getContextPath()
.
Can be null. Format: "/" + name or an empty string
for the default context.theServletPath
- the servlet path in the URL to simulate,
i.e. this is the name that will be returned by the
HttpServletRequest.getServletPath()
.
Can be null. Format : "/" + name.thePathInfo
- the path info in the URL to simulate, i.e. this is
the name that will be returned by the
HttpServletRequest.getPathInfo()
. Can
be null. Format : "/" + name.theQueryString
- the Query string in the URL to simulate, i.e. this
is the string that will be returned by the
HttpServletResquest.getQueryString()
.
Can be null.ServletURL getURL()
HttpSessionCookie getSessionCookie()
HttpSessionCookie
objectCopyright © 2000-2004 Apache Software Foundation. All Rights Reserved.