com.meterware.httpunit
Class WebResponse

java.lang.Object
  |
  +--com.meterware.httpunit.WebResponse

public class WebResponse
extends java.lang.Object

A response from a web server to an Http request.


Method Summary
 java.lang.String getCharacterSet()
          Returns the character set used in this response.
 java.lang.String getContentType()
          Returns the content type of this response.
 org.w3c.dom.Document getDOM()
          Returns a copy of the domain object model tree associated with this response.
 WebForm[] getForms()
          Returns the forms found in the page in the order in which they appear.
 WebLink[] getLinks()
          Returns the links found in the page in the order in which they appear.
 WebLink getLinkWith(java.lang.String text)
          Returns the first link which contains the specified text.
 WebLink getLinkWithImageText(java.lang.String text)
          Returns the first link which contains an image with the specified text as its 'alt' attribute.
 WebTable[] getTables()
          Returns the top-level tables found in this page in the order in which they appear.
 WebTable getTableStartingWith(java.lang.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(java.lang.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.
 java.lang.String getText()
          Returns the text of the response (excluding headers) as a string.
 java.lang.String getTitle()
          Returns the title of the page.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getContentType

public java.lang.String getContentType()
Returns the content type of this response.

getCharacterSet

public java.lang.String getCharacterSet()
Returns the character set used in this response.

getTitle

public java.lang.String getTitle()
                          throws org.xml.sax.SAXException
Returns the title of the page.

getForms

public WebForm[] getForms()
                   throws org.xml.sax.SAXException
Returns the forms found in the page in the order in which they appear.
Throws:
org.xml.sax.SAXException - thrown if there is an error parsing the response.

getLinks

public WebLink[] getLinks()
                   throws org.xml.sax.SAXException
Returns the links found in the page in the order in which they appear.
Throws:
org.xml.sax.SAXException - thrown if there is an error parsing the response.

getLinkWith

public WebLink getLinkWith(java.lang.String text)
                    throws org.xml.sax.SAXException
Returns the first link which contains the specified text.

getLinkWithImageText

public WebLink getLinkWithImageText(java.lang.String text)
                             throws org.xml.sax.SAXException
Returns the first link which contains an image with the specified text as its 'alt' attribute.

getTables

public WebTable[] getTables()
                     throws org.xml.sax.SAXException
Returns the top-level tables found in this page in the order in which they appear.
Throws:
org.xml.sax.SAXException - thrown if there is an error parsing the response.

getDOM

public org.w3c.dom.Document getDOM()
                            throws org.xml.sax.SAXException
Returns a copy of the domain object model tree associated with this response.
Throws:
org.xml.sax.SAXException - thrown if there is an error parsing the response.

getTableStartingWith

public WebTable getTableStartingWith(java.lang.String text)
                              throws org.xml.sax.SAXException
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. Will recurse into any nested tables, as needed. Case is ignored.
Returns:
the selected table, or null if none is found
Throws:
org.xml.sax.SAXException - thrown if there is an error parsing the response.

getTableStartingWithPrefix

public WebTable getTableStartingWithPrefix(java.lang.String text)
                                    throws org.xml.sax.SAXException
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. Will recurse into any nested tables, as needed. Case is ignored.
Returns:
the selected table, or null if none is found
Throws:
org.xml.sax.SAXException - thrown if there is an error parsing the response.

getText

public java.lang.String getText()
Returns the text of the response (excluding headers) as a string. Use this method in preference to 'toString' which may be used to represent internal state of this object.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Copyright © 2000 Russell Gold. See license agreement for rights granted.