|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | POINTCUT | FIELD | CONSTRUCTOR | METHOD | DETAIL: FIELD | POINTCUT | CONSTRUCTOR | METHOD |
java.lang.Object | +--org.apache.cactus.WebRequest
Contains all HTTP request data for a test case. It is the data that
will be sent to the server redirector and that will be available to the test
methods through the HttpServletRequest
object.
Namely, it is :
HttpServletRequest.getParameters()
,HttpServletRequest.getCookies()
,HttpServletRequest.getHeader(), getHeaders(),
...
APIs,HttpServletRequest.getRequestURI(), ...
Field Summary | |
static String |
GET_METHOD
GET Method identifier. |
static String |
POST_METHOD
POST Method identifier. |
Constructor Summary | |
WebRequest()
Contains all HTTP request data for a test case. |
Method Summary | |
void |
addCookie(String theName,
String theValue)
Adds a cookie to the request. Affected by: LogAspect |
void |
addCookie(String theDomain,
String theName,
String theValue)
Adds a cookie to the request. Affected by: LogAspect |
void |
addCookie(Cookie theCookie)
Adds a cookie to the request. Affected by: LogAspect |
void |
addHeader(String theName,
String theValue)
Adds a header to the request. Affected by: LogAspect |
void |
addParameter(String theName,
String theValue,
String theMethod)
Adds a parameter to the request. Affected by: LogAspect |
void |
addParameter(String theName,
String theValue)
Adds a parameter to the request. Affected by: LogAspect |
AbstractAuthentication |
getAuthentication()
|
boolean |
getAutomaticSession()
|
String |
getContentType()
|
Vector |
getCookies()
|
String |
getHeader(String theName)
Returns the first value corresponding to this header's name. Affected by: LogAspect |
Enumeration |
getHeaderNames()
|
String[] |
getHeaderValues(String theName)
Returns all the values associated with this header's name. Affected by: LogAspect |
String |
getParameterGet(String theName)
Returns the first value corresponding to this parameter's name (provided this parameter is passed in the URL). Affected by: LogAspect |
Enumeration |
getParameterNamesGet()
|
Enumeration |
getParameterNamesPost()
|
String |
getParameterPost(String theName)
Returns the first value corresponding to this parameter's name (provided this parameter is passed in the request body - POST). Affected by: LogAspect |
String[] |
getParameterValuesGet(String theName)
Returns all the values corresponding to this parameter's name (provided this parameter is passed in the URL). Affected by: LogAspect |
String[] |
getParameterValuesPost(String theName)
Returns all the values corresponding to this parameter's name (provided this parameter is passed in the request body - POST). Affected by: LogAspect |
String |
getRedirectorName()
|
ServletURL |
getURL()
|
InputStream |
getUserData()
|
void |
setAuthentication(AbstractAuthentication theAuthenticationObject)
Sets the authentication object that will configure the http request Affected by: LogAspect |
void |
setAutomaticSession(boolean isAutomaticSession)
Affected by: LogAspect |
void |
setContentType(String theContentType)
Sets the content type that will be set in the http request Affected by: LogAspect |
void |
setRedirectorName(String theRedirectorName)
Override the redirector Name defined in cactus.properties .
Affected by: LogAspect |
void |
setURL(String theServerName,
String theContextPath,
String theServletPath,
String thePathInfo,
String theQueryString)
Sets the simulated URL. Affected by: LogAspect |
void |
setUserData(InputStream theDataStream)
Allow the user to send arbitrary data in the request body Affected by: LogAspect |
String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String GET_METHOD
public static final String POST_METHOD
Constructor Detail |
public WebRequest()
HttpServletRequest
object.
HttpServletRequest.getParameters()
,HttpServletRequest.getCookies()
,HttpServletRequest.getHeader(), getHeaders(),
...
APIs,HttpServletRequest.getRequestURI(), ...
Method Detail |
public void addCookie(String theName, String theValue)
addCookie(String theDomain, String theName,
String theValue)
method or the
addCookie(Cookie theCookie)
if you wish to specify a
domain.
Note that the domain must match either the redirector host
(specified in cactus.properties
) or the host set
using setURL()
.
theName
- the cookie's name
theValue
- the cookie's value
around() in LogAspect
.public void addCookie(String theDomain, String theName, String theValue)
cactus.properties
) or the host set
using setURL()
.
theDomain
- the cookie domain
theName
- the cookie name
theValue
- the cookie value
around() in LogAspect
.public void addCookie(Cookie theCookie)
cactus.properties
) or the host set
using setURL()
.
theCookie
- the cookie to add
around() in LogAspect
.public void addHeader(String theName, String theValue)
theName
- the header's name
theValue
- the header's value
around() in LogAspect
.public void addParameter(String theName, String theValue, String theMethod)
HttpServletRequest
).
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.
around() in LogAspect
.public void addParameter(String theName, String theValue)
theName
- the parameter's name
theValue
- the parameter's value
addParameter(String, String, String)
around() in LogAspect
.public AbstractAuthentication getAuthentication()
public boolean getAutomaticSession()
public String getContentType()
public Vector getCookies()
Cookie
objects)
public String getHeader(String theName)
- theName the header's name
around() in LogAspect
.public Enumeration getHeaderNames()
public String[] getHeaderValues(String theName)
- theName the header's name
around() in LogAspect
.public String getParameterGet(String theName)
theName
- the parameter's name
around() in LogAspect
.public Enumeration getParameterNamesGet()
public Enumeration getParameterNamesPost()
public String getParameterPost(String theName)
theName
- the parameter's name
around() in LogAspect
.public String[] getParameterValuesGet(String theName)
theName
- the parameter's name
around() in LogAspect
.public String[] getParameterValuesPost(String theName)
theName
- the parameter's name
around() in LogAspect
.public String getRedirectorName()
public ServletURL getURL()
public InputStream getUserData()
public void setAuthentication(AbstractAuthentication theAuthenticationObject)
theAuthenticationObject
- the authentication object
around() in LogAspect
.public void setAutomaticSession(boolean isAutomaticSession)
isAutomaticSession
- whether the redirector servlet will
automatically create the HTTP session or not. Default is true.
around() in LogAspect
.public void setContentType(String theContentType)
theContentType
- the content type
around() in LogAspect
.public void setRedirectorName(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 use
around() in LogAspect
.public void setURL(String theServerName, String theContextPath, String theServletPath, String thePathInfo, 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.
around() in LogAspect
.public void setUserData(InputStream theDataStream)
theDataStream
- the stream on which the data are put by the user
around() in LogAspect
.public String toString()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTRUCTOR | METHOD | DETAIL: FIELD | CONSTRUCTOR | METHOD |