Java Doc for WebResponse.java in  » Testing » HttpUnit » com » meterware » httpunit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » HttpUnit » com.meterware.httpunit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.meterware.httpunit.WebResponse

All known Subclasses:   com.meterware.httpunit.HttpWebResponse,  com.meterware.servletunit.ServletUnitWebResponse,
WebResponse
abstract public class WebResponse implements HTMLSegment,CookieSource(Code)
A response to a web request from a web server.
author:
   Russell Gold
author:
   Drew Varner
author:
   Dave Glowacki
author:
   Benoit Xhenseval

Inner Class :public class Scriptable extends ScriptableDelegate implements NamedDelegate
Inner Class :static class ByteTag
Inner Class :static class ByteTagParser

Field Summary
final static  StringBLANK_HTML
    

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
final static  WebResponsecreateBlankResponse()
    
final protected  voiddefineRawInputStream(InputStream inputStream)
    
public  WebApplet[]getApplets()
    
public  StringgetCharacterSet()
     Returns the character set used in this response.
public  intgetContentLength()
     Returns the content length of this response.
public  StringgetContentType()
     Returns the content type of this response.
 StringgetCookieHeader()
    
 CookieJargetCookieJar()
    
public  DocumentgetDOM()
     Returns a copy of the domain object model tree associated with this response.
static  StringgetDefaultEncoding()
    
public  String[]getElementNames()
     Returns a list of HTML element names contained in this HTML section.
public  HTMLElementgetElementWithID(String id)
     Returns the HTMLElement with the specified ID.
public  HTMLElement[]getElementsWithAttribute(String name, String value)
     Returns the HTMLElements found with the specified attribute value.
public  HTMLElement[]getElementsWithName(String name)
     Returns the HTMLElements found in this segment with the specified name.
public  StringgetExternalStyleSheet()
     Returns the stylesheet linked in the head of the page.
public  WebFormgetFirstMatchingForm(HTMLElementPredicate predicate, Object criteria)
     Returns the first form found in the page matching the specified criteria.
public  WebLinkgetFirstMatchingLink(HTMLElementPredicate predicate, Object criteria)
     Returns the first link found in the page matching the specified criteria.
public  WebTablegetFirstMatchingTable(HTMLElementPredicate predicate, Object criteria)
     Returns the first table in the response which matches the specified predicate and value.
public  TextBlockgetFirstMatchingTextBlock(HTMLElementPredicate predicate, Object criteria)
     Returns the first link found in the page matching the specified criteria.
public  WebFormgetFormWithID(String ID)
     Returns the form found in the page with the specified ID.
public  WebFormgetFormWithName(String name)
     Returns the form found in the page with the specified name.
public  WebForm[]getForms()
     Returns the forms found in the page in the order in which they appear.
 FrameSelectorgetFrame()
     Returns the frame containing this page.
public  StringgetFrameName()
     Returns the name of the frame containing this page.
public  String[]getFrameNames()
     Returns the names of the frames found in the page in the order in which they appear.
 WebRequest[]getFrameRequests()
     Returns the frames found in the page in the order in which they appear.
 FrameSelector[]getFrameSelectors()
     Returns the frames found in the page in the order in which they appear.
abstract public  StringgetHeaderField(String fieldName)
     Returns the value for the specified header field.
abstract public  String[]getHeaderFieldNames()
     Returns the names of the header fields found in the response.
public  WebImagegetImageWithAltText(String altText)
     Returns the first image found in the page with the specified alt attribute.
public  WebImagegetImageWithName(String source)
     Returns the image found in the page with the specified name attribute.
public  WebImagegetImageWithSource(String source)
     Returns the first image found in the page with the specified src attribute.
public  WebImage[]getImages()
     Returns the images found in the page in the order in which they appear.
public  InputStreamgetInputStream()
     Returns a buffered input stream for reading the contents of this reply.
public  WebLinkgetLinkWith(String text)
     Returns the first link which contains the specified text.
public  WebLinkgetLinkWithID(String ID)
     Returns the link found in the page with the specified ID.
public  WebLinkgetLinkWithImageText(String text)
     Returns the first link which contains an image with the specified text as its 'alt' attribute.
public  WebLinkgetLinkWithName(String name)
     Returns the link found in the page with the specified name.
public  WebLink[]getLinks()
     Returns the links found in the page in the order in which they appear.
public  WebForm[]getMatchingForms(HTMLElementPredicate predicate, Object criteria)
     Returns all forms found in the page matching the specified criteria.
public  WebLink[]getMatchingLinks(HTMLElementPredicate predicate, Object criteria)
     Returns all links found in the page matching the specified criteria.
public  WebTable[]getMatchingTables(HTMLElementPredicate predicate, Object criteria)
     Returns all tables found in the page matching the specified criteria.
public  String[]getMetaTagContent(String attribute, String attributeValue)
     Retrieves the "content" of the meta tags for a key pair attribute-attributeValue.
public  String[]getNewCookieNames()
     Returns a list of new cookie names defined as part of this response.
public  StringgetNewCookieValue(String name)
     Returns the new cookie value defined as part of this response.
public  TextBlockgetNextTextBlock(TextBlock block)
     Returns the text block after the specified block, if any.
 HTMLPagegetReceivedPage()
    
 StringgetReferer()
    
public  intgetRefreshDelay()
     Returns the delay before normally following the request to refresh this page, if any. This request will be defined by a tag in the header.
public  WebRequestgetRefreshRequest()
     Returns a request to refresh this page, if any.
abstract public  intgetResponseCode()
     Returns the response code associated with this response.
abstract public  StringgetResponseMessage()
     Returns the response message associated with this response.
public  ScriptablegetScriptableObject()
    
public  WebResponsegetSubframeContents(String subFrameName)
     Returns the contents of the specified subframe of this frameset response.
public  WebTablegetTableStartingWith(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.
public  WebTablegetTableStartingWithPrefix(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.
public  WebTablegetTableWithID(String text)
     Returns the first table in the response which has the specified text as its ID attribute. Will recurse into any nested tables, as needed. Case is ignored.
exception:
  SAXException - thrown if there is an error parsing the response.
public  WebTablegetTableWithSummary(String text)
     Returns the first table in the response which has the specified text as its summary attribute. Will recurse into any nested tables, as needed. Case is ignored.
exception:
  SAXException - thrown if there is an error parsing the response.
public  WebTable[]getTables()
     Returns the top-level tables found in this page in the order in which they appear.
public  StringgetText()
     Returns the text of the response (excluding headers) as a string.
public  TextBlock[]getTextBlocks()
     Returns an array of text blocks found in the page.
public  StringgetTitle()
     Returns the title of the page.
public  URLgetURL()
     Returns the URL which invoked this response.
 WebWindowgetWindow()
    
public  booleanisHTML()
     Returns true if the response is HTML.
protected  voidloadResponseText()
    
public static  ScriptableDelegatenewDelegate(String delegateClassName)
    
public static  WebResponsenewResponse(URLConnection connection)
     Returns a web response built from a URL connection.
 booleanreplaceText(String text, String contentType)
    
protected  voidsetContentTypeHeader(String value)
     Overwrites the current value (if any) of the content type header.
 voidsetCookie(String name, String value)
    
 voidsetFrame(FrameSelector frame)
    
 voidsetWindow(WebWindow window)
    
abstract public  StringtoString()
    

Field Detail
BLANK_HTML
final static String BLANK_HTML(Code)




Constructor Detail
WebResponse
protected WebResponse(WebClient client, FrameSelector frame, URL url)(Code)
Constructs a response object.
Parameters:
  frame - the frame to hold the response
Parameters:
  url - the url from which the response was received



WebResponse
protected WebResponse(WebClient client, FrameSelector frame, URL url, String text)(Code)
Constructs a response object.
Parameters:
  frame - the frame to hold the response
Parameters:
  url - the url from which the response was received




Method Detail
createBlankResponse
final static WebResponse createBlankResponse()(Code)



defineRawInputStream
final protected void defineRawInputStream(InputStream inputStream) throws IOException(Code)



getApplets
public WebApplet[] getApplets() throws SAXException(Code)



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



getContentLength
public int getContentLength()(Code)
Returns the content length of this response. the content length, if known, or -1.



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



getCookieHeader
String getCookieHeader()(Code)



getCookieJar
CookieJar getCookieJar()(Code)



getDOM
public Document getDOM() throws SAXException(Code)
Returns a copy of the domain object model tree associated with this response. If the response is HTML, it will use a special parser which can transform HTML into an XML DOM.
exception:
  SAXException - thrown if there is an error parsing the response.



getDefaultEncoding
static String getDefaultEncoding()(Code)



getElementNames
public String[] getElementNames() throws SAXException(Code)
Returns a list of HTML element names contained in this HTML section.



getElementWithID
public HTMLElement getElementWithID(String id) throws SAXException(Code)
Returns the HTMLElement with the specified ID.
throws:
  SAXException - thrown if there is an error parsing the response.



getElementsWithAttribute
public HTMLElement[] getElementsWithAttribute(String name, String value) throws SAXException(Code)
Returns the HTMLElements found with the specified attribute value.
since:
   1.6



getElementsWithName
public HTMLElement[] getElementsWithName(String name) throws SAXException(Code)
Returns the HTMLElements found in this segment with the specified name.



getExternalStyleSheet
public String getExternalStyleSheet() throws SAXException(Code)
Returns the stylesheet linked in the head of the page. will return "/mystyle.css".
exception:
  SAXException - thrown if there is an error parsing this response



getFirstMatchingForm
public WebForm getFirstMatchingForm(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns the first form found in the page matching the specified criteria.
exception:
  SAXException - thrown if there is an error parsing the response.



getFirstMatchingLink
public WebLink getFirstMatchingLink(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns the first link found in the page matching the specified criteria.
exception:
  SAXException - thrown if there is an error parsing the response.



getFirstMatchingTable
public WebTable getFirstMatchingTable(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns the first table in the response which matches the specified predicate and value. Will recurse into any nested tables, as needed. the selected table, or null if none is found



getFirstMatchingTextBlock
public TextBlock getFirstMatchingTextBlock(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns the first link found in the page matching the specified criteria.
since:
   1.6
exception:
  SAXException - thrown if there is an error parsing the response.



getFormWithID
public WebForm getFormWithID(String ID) throws SAXException(Code)
Returns the form found in the page with the specified ID.
exception:
  SAXException - thrown if there is an error parsing the response.



getFormWithName
public WebForm getFormWithName(String name) throws SAXException(Code)
Returns the form found in the page with the specified name.
exception:
  SAXException - thrown if there is an error parsing the response.



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



getFrame
FrameSelector getFrame()(Code)
Returns the frame containing this page.



getFrameName
public String getFrameName()(Code)
Returns the name of the frame containing this page.



getFrameNames
public String[] getFrameNames() throws SAXException(Code)
Returns the names of the frames found in the page in the order in which they appear.
exception:
  SAXException - thrown if there is an error parsing this response



getFrameRequests
WebRequest[] getFrameRequests() throws SAXException(Code)
Returns the frames found in the page in the order in which they appear.



getFrameSelectors
FrameSelector[] getFrameSelectors() throws SAXException(Code)
Returns the frames found in the page in the order in which they appear.
exception:
  SAXException - thrown if there is an error parsing this response



getHeaderField
abstract public String getHeaderField(String fieldName)(Code)
Returns the value for the specified header field. If no such field is defined, will return null. If more than one header is defined for the specified name, returns only the first found.



getHeaderFieldNames
abstract public String[] getHeaderFieldNames()(Code)
Returns the names of the header fields found in the response.



getImageWithAltText
public WebImage getImageWithAltText(String altText) throws SAXException(Code)
Returns the first image found in the page with the specified alt attribute.



getImageWithName
public WebImage getImageWithName(String source) throws SAXException(Code)
Returns the image found in the page with the specified name attribute.
exception:
  SAXException - thrown if there is an error parsing the response.



getImageWithSource
public WebImage getImageWithSource(String source) throws SAXException(Code)
Returns the first image found in the page with the specified src attribute.
exception:
  SAXException - thrown if there is an error parsing the response.



getImages
public WebImage[] getImages() throws SAXException(Code)
Returns the images found in the page in the order in which they appear.
exception:
  SAXException - thrown if there is an error parsing the response.



getInputStream
public InputStream getInputStream() throws IOException(Code)
Returns a buffered input stream for reading the contents of this reply.



getLinkWith
public WebLink getLinkWith(String text) throws SAXException(Code)
Returns the first link which contains the specified text.
exception:
  SAXException - thrown if there is an error parsing the response.



getLinkWithID
public WebLink getLinkWithID(String ID) throws SAXException(Code)
Returns the link found in the page with the specified ID.
exception:
  SAXException - thrown if there is an error parsing the response.



getLinkWithImageText
public WebLink getLinkWithImageText(String text) throws SAXException(Code)
Returns the first link which contains an image with the specified text as its 'alt' attribute.
exception:
  SAXException - thrown if there is an error parsing the response.



getLinkWithName
public WebLink getLinkWithName(String name) throws SAXException(Code)
Returns the link found in the page with the specified name.
exception:
  SAXException - thrown if there is an error parsing the response.



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



getMatchingForms
public WebForm[] getMatchingForms(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns all forms found in the page matching the specified criteria.
exception:
  SAXException - thrown if there is an error parsing the response.



getMatchingLinks
public WebLink[] getMatchingLinks(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns all links found in the page matching the specified criteria.
exception:
  SAXException - thrown if there is an error parsing the response.



getMatchingTables
public WebTable[] getMatchingTables(HTMLElementPredicate predicate, Object criteria) throws SAXException(Code)
Returns all tables found in the page matching the specified criteria.
exception:
  SAXException - thrown if there is an error parsing the response.



getMetaTagContent
public String[] getMetaTagContent(String attribute, String attributeValue) throws SAXException(Code)
Retrieves the "content" of the meta tags for a key pair attribute-attributeValue. this can be used like this getMetaTagContent("name","robots") will return { "index","follow" } getMetaTagContent("http-equiv","Expires") will return { "now" }
exception:
  SAXException - thrown if there is an error parsing this response



getNewCookieNames
public String[] getNewCookieNames()(Code)
Returns a list of new cookie names defined as part of this response.



getNewCookieValue
public String getNewCookieValue(String name)(Code)
Returns the new cookie value defined as part of this response.



getNextTextBlock
public TextBlock getNextTextBlock(TextBlock block) throws SAXException(Code)
Returns the text block after the specified block, if any.
since:
   1.6



getReceivedPage
HTMLPage getReceivedPage() throws SAXException(Code)



getReferer
String getReferer()(Code)



getRefreshDelay
public int getRefreshDelay()(Code)
Returns the delay before normally following the request to refresh this page, if any. This request will be defined by a tag in the header. If no tag exists, will return zero.



getRefreshRequest
public WebRequest getRefreshRequest()(Code)
Returns a request to refresh this page, if any. This request will be defined by a tag in the header. If no tag exists, will return null.



getResponseCode
abstract public int getResponseCode()(Code)
Returns the response code associated with this response.



getResponseMessage
abstract public String getResponseMessage()(Code)
Returns the response message associated with this response.



getScriptableObject
public Scriptable getScriptableObject()(Code)



getSubframeContents
public WebResponse getSubframeContents(String subFrameName)(Code)
Returns the contents of the specified subframe of this frameset response.
Parameters:
  subFrameName - the name of the desired frame as defined in the frameset.



getTableStartingWith
public WebTable getTableStartingWith(String text) throws SAXException(Code)
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.
exception:
  SAXException - thrown if there is an error parsing the response. the selected table, or null if none is found



getTableStartingWithPrefix
public WebTable getTableStartingWithPrefix(String text) throws SAXException(Code)
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.
exception:
  SAXException - thrown if there is an error parsing the response. the selected table, or null if none is found



getTableWithID
public WebTable getTableWithID(String text) throws SAXException(Code)
Returns the first table in the response which has the specified text as its ID attribute. Will recurse into any nested tables, as needed. Case is ignored.
exception:
  SAXException - thrown if there is an error parsing the response. the selected table, or null if none is found



getTableWithSummary
public WebTable getTableWithSummary(String text) throws SAXException(Code)
Returns the first table in the response which has the specified text as its summary attribute. Will recurse into any nested tables, as needed. Case is ignored.
exception:
  SAXException - thrown if there is an error parsing the response. the selected table, or null if none is found



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



getText
public String getText() throws IOException(Code)
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.



getTextBlocks
public TextBlock[] getTextBlocks() throws SAXException(Code)
Returns an array of text blocks found in the page.
since:
   1.6



getTitle
public String getTitle() throws SAXException(Code)
Returns the title of the page.
exception:
  SAXException - thrown if there is an error parsing this response



getURL
public URL getURL()(Code)
Returns the URL which invoked this response.



getWindow
WebWindow getWindow()(Code)



isHTML
public boolean isHTML()(Code)
Returns true if the response is HTML.



loadResponseText
protected void loadResponseText() throws IOException(Code)



newDelegate
public static ScriptableDelegate newDelegate(String delegateClassName)(Code)



newResponse
public static WebResponse newResponse(URLConnection connection) throws IOException(Code)
Returns a web response built from a URL connection. Provided to allow access to WebResponse parsing without using a WebClient.



replaceText
boolean replaceText(String text, String contentType)(Code)



setContentTypeHeader
protected void setContentTypeHeader(String value)(Code)
Overwrites the current value (if any) of the content type header.



setCookie
void setCookie(String name, String value)(Code)



setFrame
void setFrame(FrameSelector frame)(Code)



setWindow
void setWindow(WebWindow window)(Code)



toString
abstract public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.