Download Wiley - Java Tools for Extreme Programming
Transcript
The following example illustrates how to add setUp information for a specific testXXX method to the request
that will be sent to the server.
public void beginGoOnVisionQuest(WebRequest request){
/* The URL being constructed is:
http://nationalparks.org/organ-pipe-monument/long_walk.do
*/
request.setURL("nationalparks.org",
"/organ-pipe-monument",
null,
"/long_walk.do",
null);
/*multiple values for same key*/
request.addParameter("SPIRIT_GUIDES", "Coyote");
request.addParameter("SPIRIT_GUIDES", "Snake");
request.addCookie("PREPARED", "true");
}
Methods
Most of the accessor methods are used by the framework during the translation of this class into an actual
HTTP request. These methods work like the methods specified in HttpServletRequest with the same
signatures.
addCookie(Cookie theCookie)
public void addCookie(Cookie theCookie)
This method adds the org.apache.cactus.Cookie instance to the request. See the Cookie class for details on
the cookie domains in Cactus.
addCookie(String theName, String theValue)
public void addCookie(String theName, String theValue)
This method adds a cookie consisting of the specified name/value pair to the HTTP request with "localhost" as
the cookie domain. See the Cookie class section for details on the cookie domains in Cactus.
addCookie(String theDomain, String theName, String theValue)
public void addCookie(String theDomain, String theName, String theValue)
This method adds a cookie with the specified name, value, and domain to the request. See the Cookie class
section for details on the cookie domains in Cactus.
addHeader(String theName, String theValue)
public void addHeader(String theName, String theValue)
This method adds a header consisting of the specified name/value pair to the request. Multiple headers with a
given name can be added.
addParameter(String theName, String theValue)
public void addParameter(String theName, String theValue)
This method adds a request parameter consisting of the specified name/value pair. Multiple parameter values
can be added under a given name (to support retrieval with HttpSevletRequest.getParameterValues(String) on
the server side).
getAutomaticSession()
public boolean getAutomaticSession()
This method is the accessor for the automaticSession property. (See the section on setAutomaticSession for
more details.)
374
Related documents
Herong`s Notes on JSP
My Java and Object-Oriented Analysis and Design Training Material
FAKULT¨AT F¨UR INFORMATIK A Web
Creator (Creation Date)
Sun Virtual Desktop Infrastructure
VDI 3.1 Administration Guide
PDF documentation
NetRexx User's Guide
Cours 6 : TCP java.net Patron MVC & Procuration
BEA WebLogic Server 7 Specifications