com.meterware.httpunit
public abstract class WebResponse extends Object implements HTMLSegment, CookieSource
Nested Class Summary | |
---|---|
class | WebResponse.Scriptable |
Constructor Summary | |
---|---|
protected | WebResponse(WebClient client, FrameSelector frame, URL url)
Constructs a response object. |
protected | WebResponse(WebClient client, FrameSelector frame, URL url, String text)
Constructs a response object. |
Method Summary | |
---|---|
protected void | defineRawInputStream(InputStream inputStream) |
WebApplet[] | getApplets() |
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[] | getElementNames()
Returns a list of HTML element names contained in this HTML section. |
HTMLElement[] | getElementsWithAttribute(String name, String value)
Returns the HTMLElements found with the specified attribute value. |
HTMLElement[] | getElementsWithName(String name)
Returns the HTMLElements found in this segment with the specified name. |
HTMLElement | getElementWithID(String id)
Returns the HTMLElement with the specified ID. |
String | getExternalStyleSheet()
Returns the stylesheet linked in the head of the page.
|
WebForm | getFirstMatchingForm(HTMLElementPredicate predicate, Object criteria)
Returns the first form found in the page matching the specified criteria. |
WebLink | getFirstMatchingLink(HTMLElementPredicate predicate, Object criteria)
Returns the first link found in the page matching the specified criteria. |
WebTable | getFirstMatchingTable(HTMLElementPredicate predicate, Object criteria)
Returns the first table in the response which matches the specified predicate and value.
|
TextBlock | getFirstMatchingTextBlock(HTMLElementPredicate predicate, Object criteria)
Returns the first link found in the page matching the specified criteria. |
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 | getFrameName()
Returns the name of the frame containing this page.
|
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.
|
WebImage[] | getImages()
Returns the images found in the page in the order in which they appear. |
WebImage | getImageWithAltText(String altText)
Returns the first image found in the page with the specified alt attribute.
|
WebImage | getImageWithName(String source)
Returns the image found in the page with the specified name attribute. |
WebImage | getImageWithSource(String source)
Returns the first image found in the page with the specified src attribute. |
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. |
WebForm[] | getMatchingForms(HTMLElementPredicate predicate, Object criteria)
Returns all forms found in the page matching the specified criteria. |
WebLink[] | getMatchingLinks(HTMLElementPredicate predicate, Object criteria)
Returns all links found in the page matching the specified criteria. |
WebTable[] | getMatchingTables(HTMLElementPredicate predicate, Object criteria)
Returns all tables found in the page matching the specified criteria. |
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.
|
TextBlock | getNextTextBlock(TextBlock block)
Returns the text block after the specified block, if any. |
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.Scriptable | getScriptableObject() |
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 | getText()
Returns the text of the response (excluding headers) as a string. |
TextBlock[] | getTextBlocks()
Returns an array of text blocks found in the page. |
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 ScriptableDelegate | newDelegate(String delegateClassName) |
static WebResponse | newResponse(URLConnection connection)
Returns a web response built from a URL connection. |
protected void | setContentTypeHeader(String value)
Overwrites the current value (if any) of the content type header.
|
abstract String | toString() |
Parameters: frame the frame to hold the response url the url from which the response was received
Parameters: frame the frame to hold the response url the url from which the response was received
Returns: the content length, if known, or -1.
Throws: SAXException thrown if there is an error parsing the response.
Since: 1.6
Throws: SAXException thrown if there is an error parsing the response.
will return "/mystyle.css".Throws: SAXException thrown if there is an error parsing this response
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Returns: the selected table, or null if none is found
Throws: SAXException thrown if there is an error parsing the response.
Since: 1.6
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing this response
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
Throws: SAXException thrown if there is an error parsing the response.
this can be used like this
getMetaTagContent("name","robots") will return { "index","follow" }
getMetaTagContent("http-equiv","Expires") will return { "now" }
Throws: SAXException thrown if there is an error parsing this response
Since: 1.6
Parameters: subFrameName the name of the desired frame as defined in the frameset.
Throws: SAXException thrown if there is an error parsing the response.
Returns: the selected table, or null if none is found
Throws: SAXException thrown if there is an error parsing the response.
Returns: the selected table, or null if none is found
Throws: SAXException thrown if there is an error parsing the response.
Returns: the selected table, or null if none is found
Throws: SAXException thrown if there is an error parsing the response.
Returns: the selected table, or null if none is found
Throws: SAXException thrown if there is an error parsing the response.
Since: 1.6
Throws: SAXException thrown if there is an error parsing this response