|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectwebapplicationtestcase.HttpResponse
public class HttpResponse
This class represents an http response from the web application.
| Constructor Summary | |
|---|---|
HttpResponse()
|
|
| Method Summary | |
|---|---|
boolean |
containsTag(java.lang.String tagName,
java.util.Map attributes,
java.lang.String text)
Determines if a tag is contained in the content of the response. |
java.lang.String |
getContent()
Accessor for the content of the response. |
java.lang.String |
getContentType()
Accessor for the content type of the response. |
java.util.Map |
getHeaderFields()
A map of the response headers. |
java.util.List |
getNodes()
The parsed nodes of the response. |
int |
getStatus()
Accessor for the http response status code. |
Tag[] |
getTagsByName(java.lang.String tagName)
Finds tags contained in the response (html only) by name. |
static boolean |
isStatusRedirect(int status)
Determines if the http status code is a redirect. |
void |
setContent(java.lang.String contentType,
java.lang.String content)
Setter for the content of the response. |
void |
setHeaderFields(java.util.Map headerFields)
Sets the header fields for this response. |
void |
setStatus(int status)
Setter for the http response status code. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpResponse()
| Method Detail |
|---|
public static boolean isStatusRedirect(int status)
status - the status to evaluate.
true if status is a redirect, false otherwise.public java.lang.String getContentType()
public java.util.Map getHeaderFields()
java.lang.Strings
and the value is an unmodifiable java.util.List of java.lang.Strings.
URLConnection.getHeaderFields()public void setHeaderFields(java.util.Map headerFields)
java.lang.Strings for the keys, and a java.util.List of java.lang.Strings
for the values.
headerFields - a map of header fields to set for this responsepublic int getStatus()
public void setStatus(int status)
status - the http response code for this response.public java.lang.String getContent()
public void setContent(java.lang.String contentType,
java.lang.String content)
contentType - the content type of the response, e.g. "text/html" or "text/xml"content - a String containing the content of the response
public boolean containsTag(java.lang.String tagName,
java.util.Map attributes,
java.lang.String text)
tagName - the name of the tag to find, e.g. "span", "div", "img", "a", "p"attributes - a map of the attributestext - a String containing the text to find
true if a tag, or text, is found, false otherwisepublic Tag[] getTagsByName(java.lang.String tagName)
getTagsByName("a");.
tagName - the name of tags to find, e.g. "span", "div", "a"
Tags with the name specified, the array will be empty if none are found.public java.util.List getNodes()
Strings or Tags. String represent text nodes.
- Returns:
- a
List of the nodes of the response.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||