|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.meterware.httpunit.WebResponse
A response to a web request from a web server.
Nested Class Summary | |
class |
WebResponse.Scriptable
|
Constructor Summary | |
protected |
WebResponse(WebClient client,
FrameSelector frame,
java.net.URL url)
Constructs a response object. |
protected |
WebResponse(WebClient client,
FrameSelector frame,
java.net.URL url,
java.lang.String text)
Constructs a response object. |
Method Summary | |
void |
alert(java.lang.String message)
|
void |
close()
|
boolean |
confirm(java.lang.String message)
|
ScriptingHandler |
createDomScriptingHandler()
create a DOMScriptingHandler |
ScriptingHandler |
createJavascriptScriptingHandler()
|
protected void |
defineRawInputStream(java.io.InputStream inputStream)
|
WebApplet[] |
getApplets()
Returns the applets found in the page in the order in which they appear. |
java.lang.String |
getCharacterSet()
Returns the character set used in this response. |
WebClient |
getClient()
getter for the WebClient |
int |
getContentLength()
Returns the content length of 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. |
java.lang.String[] |
getElementNames()
Returns a list of HTML element names contained in this HTML section. |
HTMLElement[] |
getElementsByTagName(java.lang.String tagName)
return the HTMLElements with the specified tag name |
HTMLElement[] |
getElementsWithAttribute(java.lang.String name,
java.lang.String value)
Returns the HTMLElements found with the specified attribute value. |
HTMLElement[] |
getElementsWithName(java.lang.String name)
Returns the HTMLElements found in this segment with the specified name. |
HTMLElement |
getElementWithID(java.lang.String id)
Returns the HTMLElement with the specified ID. |
java.lang.String |
getExternalStyleSheet()
Returns the stylesheet linked in the head of the page. |
WebForm |
getFirstMatchingForm(HTMLElementPredicate predicate,
java.lang.Object criteria)
Returns the first form found in the page matching the specified criteria. |
WebLink |
getFirstMatchingLink(HTMLElementPredicate predicate,
java.lang.Object criteria)
Returns the first link found in the page matching the specified criteria. |
WebTable |
getFirstMatchingTable(HTMLElementPredicate predicate,
java.lang.Object criteria)
Returns the first table in the response which matches the specified predicate and value. |
TextBlock |
getFirstMatchingTextBlock(HTMLElementPredicate predicate,
java.lang.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(java.lang.String ID)
Returns the form found in the page with the specified ID. |
WebForm |
getFormWithName(java.lang.String name)
Returns the form found in the page with the specified name. |
java.lang.String |
getFrameName()
Returns the name of the frame containing this page. |
java.lang.String[] |
getFrameNames()
Returns the names of the frames found in the page in the order in which they appear. |
abstract java.lang.String |
getHeaderField(java.lang.String fieldName)
Returns the value for the specified header field. |
abstract java.lang.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(java.lang.String altText)
Returns the first image found in the page with the specified alt attribute. |
WebImage |
getImageWithName(java.lang.String source)
Returns the image found in the page with the specified name attribute. |
WebImage |
getImageWithSource(java.lang.String source)
Returns the first image found in the page with the specified src attribute. |
java.io.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(java.lang.String text)
Returns the first link which contains the specified text. |
WebLink |
getLinkWithID(java.lang.String ID)
Returns the link found in the page with the specified ID. |
WebLink |
getLinkWithImageText(java.lang.String text)
Returns the first link which contains an image with the specified text as its 'alt' attribute. |
WebLink |
getLinkWithName(java.lang.String name)
Returns the link found in the page with the specified name. |
WebForm[] |
getMatchingForms(HTMLElementPredicate predicate,
java.lang.Object criteria)
Returns all forms found in the page matching the specified criteria. |
WebLink[] |
getMatchingLinks(HTMLElementPredicate predicate,
java.lang.Object criteria)
Returns all links found in the page matching the specified criteria. |
WebTable[] |
getMatchingTables(HTMLElementPredicate predicate,
java.lang.Object criteria)
Returns all tables found in the page matching the specified criteria. |
java.lang.String[] |
getMetaTagContent(java.lang.String attribute,
java.lang.String attributeValue)
Retrieves the "content" of the meta tags for a key pair attribute-attributeValue. |
java.lang.String[] |
getNewCookieNames()
Returns a list of new cookie names defined as part of this response. |
java.lang.String |
getNewCookieValue(java.lang.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 java.lang.String |
getResponseMessage()
Returns the response message associated with this response. |
WebResponse.Scriptable |
getScriptableObject()
get the scriptable object for this WebResponse |
ScriptingHandler |
getScriptingHandler()
|
WebResponse |
getSubframeContents(java.lang.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(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. |
WebTable |
getTableWithID(java.lang.String text)
Returns the first table in the response which has the specified text as its ID attribute. |
WebTable |
getTableWithSummary(java.lang.String text)
Returns the first table in the response which has the specified text as its summary attribute. |
java.lang.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. |
java.lang.String |
getTitle()
Returns the title of the page. |
java.net.URL |
getURL()
Returns the URL which invoked this response. |
static java.lang.String[] |
getValidContentTypes()
allow access to the valid content Types |
boolean |
isHTML()
Returns true if the response is HTML. |
protected void |
loadResponseText()
|
static ScriptableDelegate |
newDelegate(java.lang.String delegateClassName)
|
static WebResponse |
newResponse(java.net.URLConnection connection)
Returns a web response built from a URL connection. |
com.meterware.httpunit.dom.DomWindowProxy |
openNewWindow(java.lang.String name,
java.lang.String relativeUrl)
open a a new Window with the given name and relative URL |
java.lang.String |
prompt(java.lang.String prompt,
java.lang.String defaultResponse)
|
boolean |
replaceText(java.lang.String text,
java.lang.String contentType)
Replaces the text in the window with the specified text and content type. |
protected void |
setContentTypeHeader(java.lang.String value)
Overwrites the current value (if any) of the content type header. |
void |
setScriptingHandler(ScriptingHandler scriptingHandler)
|
protected static void |
setValidContentTypes(java.lang.String[] validContentTypes)
allow modification of the valid content Types use with care |
com.meterware.httpunit.dom.DomWindowProxy |
submitRequest(com.meterware.httpunit.dom.HTMLElementImpl sourceElement,
java.lang.String method,
java.lang.String location,
java.lang.String target,
com.meterware.httpunit.protocol.MessageBody requestBody)
|
abstract java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.meterware.httpunit.cookies.CookieSource |
getHeaderFields |
Constructor Detail |
protected WebResponse(WebClient client, FrameSelector frame, java.net.URL url)
frame
- the frame to hold the responseurl
- the url from which the response was receivedprotected WebResponse(WebClient client, FrameSelector frame, java.net.URL url, java.lang.String text)
frame
- the frame to hold the responseurl
- the url from which the response was receivedMethod Detail |
public static WebResponse newResponse(java.net.URLConnection connection) throws java.io.IOException
java.io.IOException
public boolean isHTML()
public java.net.URL getURL()
getURL
in interface CookieSource
public java.lang.String getTitle() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- thrown if there is an error parsing this responsepublic java.lang.String getExternalStyleSheet() throws org.xml.sax.SAXException
will return "/mystyle.css".
org.xml.sax.SAXException
- thrown if there is an error parsing this responsepublic java.lang.String[] getMetaTagContent(java.lang.String attribute, java.lang.String attributeValue) throws org.xml.sax.SAXException
this can be used like this
getMetaTagContent("name","robots") will return { "index","follow" }
getMetaTagContent("http-equiv","Expires") will return { "now" }
org.xml.sax.SAXException
- thrown if there is an error parsing this responsepublic java.lang.String getFrameName()
public WebRequest getRefreshRequest()
public int getRefreshDelay()
public abstract int getResponseCode()
public abstract java.lang.String getResponseMessage()
public int getContentLength()
public java.lang.String getContentType()
public java.lang.String getCharacterSet()
public java.lang.String[] getNewCookieNames()
public java.lang.String getNewCookieValue(java.lang.String name)
public abstract java.lang.String[] getHeaderFieldNames()
public abstract java.lang.String getHeaderField(java.lang.String fieldName)
public java.lang.String getText() throws java.io.IOException
java.io.IOException
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public java.lang.String[] getFrameNames() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- thrown if there is an error parsing this responsepublic WebResponse getSubframeContents(java.lang.String subFrameName)
subFrameName
- the name of the desired frame as defined in the frameset.public HTMLElement getElementWithID(java.lang.String id) throws org.xml.sax.SAXException
getElementWithID
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public HTMLElement[] getElementsByTagName(java.lang.String tagName) throws org.xml.sax.SAXException
tagName
- e.g. "div" or "table"
org.xml.sax.SAXException
public java.lang.String[] getElementNames() throws org.xml.sax.SAXException
getElementNames
in interface HTMLSegment
org.xml.sax.SAXException
public HTMLElement[] getElementsWithName(java.lang.String name) throws org.xml.sax.SAXException
getElementsWithName
in interface HTMLSegment
org.xml.sax.SAXException
public HTMLElement[] getElementsWithAttribute(java.lang.String name, java.lang.String value) throws org.xml.sax.SAXException
getElementsWithAttribute
in interface HTMLSegment
org.xml.sax.SAXException
public WebForm[] getForms() throws org.xml.sax.SAXException
getForms
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebForm getFormWithName(java.lang.String name) throws org.xml.sax.SAXException
getFormWithName
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebForm getFormWithID(java.lang.String ID) throws org.xml.sax.SAXException
getFormWithID
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebForm getFirstMatchingForm(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
getFirstMatchingForm
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebForm[] getMatchingForms(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
getMatchingForms
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink[] getLinks() throws org.xml.sax.SAXException
getLinks
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWith(java.lang.String text) throws org.xml.sax.SAXException
getLinkWith
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWithImageText(java.lang.String text) throws org.xml.sax.SAXException
getLinkWithImageText
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWithName(java.lang.String name) throws org.xml.sax.SAXException
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink getLinkWithID(java.lang.String ID) throws org.xml.sax.SAXException
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink getFirstMatchingLink(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
getFirstMatchingLink
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebLink[] getMatchingLinks(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
getMatchingLinks
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebImage[] getImages() throws org.xml.sax.SAXException
getImages
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebImage getImageWithName(java.lang.String source) throws org.xml.sax.SAXException
getImageWithName
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebImage getImageWithSource(java.lang.String source) throws org.xml.sax.SAXException
getImageWithSource
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebImage getImageWithAltText(java.lang.String altText) throws org.xml.sax.SAXException
getImageWithAltText
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the segment.public WebApplet[] getApplets() throws org.xml.sax.SAXException
HTMLSegment
getApplets
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the segment.public TextBlock[] getTextBlocks() throws org.xml.sax.SAXException
getTextBlocks
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the segment.public TextBlock getNextTextBlock(TextBlock block) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public TextBlock getFirstMatchingTextBlock(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public org.w3c.dom.Document getDOM() throws org.xml.sax.SAXException
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebTable[] getTables() throws org.xml.sax.SAXException
getTables
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebTable getFirstMatchingTable(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
getFirstMatchingTable
in interface HTMLSegment
org.xml.sax.SAXException
public WebTable[] getMatchingTables(HTMLElementPredicate predicate, java.lang.Object criteria) throws org.xml.sax.SAXException
getMatchingTables
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebTable getTableStartingWith(java.lang.String text) throws org.xml.sax.SAXException
getTableStartingWith
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebTable getTableStartingWithPrefix(java.lang.String text) throws org.xml.sax.SAXException
getTableStartingWithPrefix
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebTable getTableWithSummary(java.lang.String text) throws org.xml.sax.SAXException
getTableWithSummary
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebTable getTableWithID(java.lang.String text) throws org.xml.sax.SAXException
getTableWithID
in interface HTMLSegment
org.xml.sax.SAXException
- thrown if there is an error parsing the response.public WebResponse.Scriptable getScriptableObject()
public void setScriptingHandler(ScriptingHandler scriptingHandler)
public ScriptingHandler getScriptingHandler()
getScriptingHandler
in interface com.meterware.httpunit.dom.DomWindowProxy
public ScriptingHandler createJavascriptScriptingHandler()
public ScriptingHandler createDomScriptingHandler()
public static ScriptableDelegate newDelegate(java.lang.String delegateClassName)
public com.meterware.httpunit.dom.DomWindowProxy openNewWindow(java.lang.String name, java.lang.String relativeUrl) throws java.io.IOException, org.xml.sax.SAXException
openNewWindow
in interface com.meterware.httpunit.dom.DomWindowProxy
name
- - the name of the windowrelativeUrl
- - the relative URL to be used
java.io.IOException
org.xml.sax.SAXException
public com.meterware.httpunit.dom.DomWindowProxy submitRequest(com.meterware.httpunit.dom.HTMLElementImpl sourceElement, java.lang.String method, java.lang.String location, java.lang.String target, com.meterware.httpunit.protocol.MessageBody requestBody) throws java.io.IOException, org.xml.sax.SAXException
submitRequest
in interface com.meterware.httpunit.dom.DomWindowProxy
java.io.IOException
org.xml.sax.SAXException
public void close()
close
in interface com.meterware.httpunit.dom.DomWindowProxy
public void alert(java.lang.String message)
alert
in interface com.meterware.httpunit.dom.DomWindowProxy
public boolean confirm(java.lang.String message)
confirm
in interface com.meterware.httpunit.dom.DomWindowProxy
public java.lang.String prompt(java.lang.String prompt, java.lang.String defaultResponse)
prompt
in interface com.meterware.httpunit.dom.DomWindowProxy
public abstract java.lang.String toString()
protected final void defineRawInputStream(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
protected void setContentTypeHeader(java.lang.String value)
public boolean replaceText(java.lang.String text, java.lang.String contentType)
com.meterware.httpunit.dom.DomWindowProxy
replaceText
in interface com.meterware.httpunit.dom.DomWindowProxy
public WebClient getClient()
protected void loadResponseText() throws java.io.IOException
java.io.IOException
public static java.lang.String[] getValidContentTypes()
protected static void setValidContentTypes(java.lang.String[] validContentTypes)
validContentTypes
- the validContentTypes to set
|
Copyright © 2000-2008 Russell Gold. See license agreement for rights granted. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |