|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.meterware.httpunit.WebResponse
A response to a web request from a web server.
Constructor Summary | |
protected |
WebResponse(String frameName,
URL url)
Constructs a response object. |
Method Summary | |
protected void |
defineRawInputStream(InputStream inputStream)
|
String |
getCharacterSet()
Returns the character set used in this response. |
int |
getContentLength()
Returns the content length of this response. |
String |
getContentType()
Returns the content type of this response. |
Document |
getDOM()
Returns a copy of the domain object model tree associated with this response. |
String |
getExternalStyleSheet()
Returns the stylesheet linked in the head of the page. |
WebForm[] |
getForms()
Returns the forms found in the page in the order in which they appear. |
WebForm |
getFormWithID(String ID)
Returns the form found in the page with the specified ID. |
WebForm |
getFormWithName(String name)
Returns the form found in the page with the specified name. |
String[] |
getFrameNames()
Returns the names of the frames found in the page in the order in which they appear. |
abstract String |
getHeaderField(String fieldName)
Returns the value for the specified header field. |
abstract String[] |
getHeaderFieldNames()
Returns the names of the header fields found in the response. |
abstract String[] |
getHeaderFields(String fieldName)
Returns the values for the specified header field. |
InputStream |
getInputStream()
Returns a buffered input stream for reading the contents of this reply. |
WebLink[] |
getLinks()
Returns the links found in the page in the order in which they appear. |
WebLink |
getLinkWith(String text)
Returns the first link which contains the specified text. |
WebLink |
getLinkWithID(String ID)
Returns the link found in the page with the specified ID. |
WebLink |
getLinkWithImageText(String text)
Returns the first link which contains an image with the specified text as its 'alt' attribute. |
WebLink |
getLinkWithName(String name)
Returns the link found in the page with the specified name. |
String[] |
getMetaTagContent(String attribute,
String attributeValue)
Retrieves the "content" of the meta tags for a key pair attribute-attributeValue. |
String[] |
getNewCookieNames()
Returns a list of new cookie names defined as part of this response. |
String |
getNewCookieValue(String name)
Returns the new cookie value defined as part of this response. |
int |
getRefreshDelay()
Returns the delay before normally following the request to refresh this page, if any. |
WebRequest |
getRefreshRequest()
Returns a request to refresh this page, if any. |
abstract int |
getResponseCode()
Returns the response code associated with this response. |
abstract String |
getResponseMessage()
Returns the response message associated with this response. |
WebResponse |
getSubframeContents(String subFrameName)
Returns the contents of the specified subframe of this frameset response. |
WebTable[] |
getTables()
Returns the top-level tables found in this page in the order in which they appear. |
WebTable |
getTableStartingWith(String text)
Returns the first table in the response which has the specified text as the full text of its first non-blank row and non-blank column. |
WebTable |
getTableStartingWithPrefix(String text)
Returns the first table in the response which has the specified text as a prefix of the text of its first non-blank row and non-blank column. |
WebTable |
getTableWithID(String text)
Returns the first table in the response which has the specified text as its ID attribute. |
WebTable |
getTableWithSummary(String text)
Returns the first table in the response which has the specified text as its summary attribute. |
String |
getTarget()
Returns the target of the page. |
String |
getText()
Returns the text of the response (excluding headers) as a string. |
String |
getTitle()
Returns the title of the page. |
URL |
getURL()
Returns the URL which invoked this response. |
boolean |
isHTML()
Returns true if the response is HTML. |
protected void |
loadResponseText()
|
static WebResponse |
newResponse(URLConnection connection)
Returns a web response built from a URL connection. |
protected void |
readRefreshRequest(String contentTypeHeader)
|
protected void |
setContentTypeHeader(String value)
Overwrites the current value (if any) of the content type header. |
abstract String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected WebResponse(String frameName, URL url)
frameName
- the name of the frame to hold the responseurl
- the url from which the response was receivedMethod Detail |
public static WebResponse newResponse(URLConnection connection) throws IOException
public boolean isHTML()
public URL getURL()
public String getTitle() throws SAXException
SAXException
- thrown if there is an error parsing this responsepublic String getExternalStyleSheet() throws SAXException
will return "/mystyle.css".SAXException
- thrown if there is an error parsing this responsepublic String[] getMetaTagContent(String attribute, String attributeValue) throws SAXException
this can be used like this
getMetaTagContent("name","robots") will return { "index","follow" }
getMetaTagContent("http-equiv","Expires") will return { "now" }
SAXException
- thrown if there is an error parsing this responsepublic String getTarget()
public WebRequest getRefreshRequest()
public int getRefreshDelay()
public abstract int getResponseCode()
public abstract String getResponseMessage()
public int getContentLength()
public String getContentType()
public String getCharacterSet()
public String[] getNewCookieNames()
public String getNewCookieValue(String name)
public abstract String[] getHeaderFieldNames()
public abstract String getHeaderField(String fieldName)
public abstract String[] getHeaderFields(String fieldName)
public String getText() throws IOException
public InputStream getInputStream() throws IOException
public String[] getFrameNames() throws SAXException
SAXException
- thrown if there is an error parsing this responsepublic WebResponse getSubframeContents(String subFrameName)
subFrameName
- the name of the desired frame as defined in the frameset.public WebForm[] getForms() throws SAXException
getForms
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebForm getFormWithName(String name) throws SAXException
getFormWithName
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebForm getFormWithID(String ID) throws SAXException
getFormWithID
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebLink[] getLinks() throws SAXException
getLinks
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWith(String text) throws SAXException
getLinkWith
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWithImageText(String text) throws SAXException
getLinkWithImageText
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWithName(String name) throws SAXException
SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWithID(String ID) throws SAXException
SAXException
- thrown if there is an error parsing the response.public WebTable[] getTables() throws SAXException
getTables
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public Document getDOM() throws SAXException
SAXException
- thrown if there is an error parsing the response.public WebTable getTableStartingWith(String text) throws SAXException
getTableStartingWith
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebTable getTableStartingWithPrefix(String text) throws SAXException
getTableStartingWithPrefix
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebTable getTableWithSummary(String text) throws SAXException
getTableWithSummary
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public WebTable getTableWithID(String text) throws SAXException
getTableWithID
in interface HTMLSegment
SAXException
- thrown if there is an error parsing the response.public abstract String toString()
toString
in class Object
protected final void defineRawInputStream(InputStream inputStream) throws IOException
protected final void readRefreshRequest(String contentTypeHeader)
protected void setContentTypeHeader(String value)
protected void loadResponseText() throws IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |