Java Doc for WebClient.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.WebClient

All known Subclasses:   com.meterware.httpunit.WebConversation,  com.meterware.servletunit.ServletUnitClient,
WebClient
abstract public class WebClient (Code)
The context for a series of web requests. This class manages cookies used to maintain session context, computes relative URLs, and generally emulates the browser behavior needed to build an automated test of a web site.
author:
   Russell Gold
author:
   Jan Ohrstrom
author:
   Seth Ladd
author:
   Oliver Imbusch

Inner Class :public static class HeaderDictionary extends Hashtable


Constructor Summary
protected  WebClient()
    

Method Summary
public  voidaddClientListener(WebClientListener listener)
     Adds a listener to watch for requests and responses.
public  voidaddCookie(String name, String value)
     Defines a cookie to be sent to the server on every request.
public  voidaddWindowListener(WebWindowListener listener)
     Adds a listener to watch for window openings and closings.
public  voidclearContents()
     Resets the state of this client, removing all cookies, frames, and per-client headers.
public  voidclearProxyServer()
     Clears the proxy server settings.
 voidclose(WebWindow window)
    
 FrameSelectorfindFrame(String target)
    
public  ClientPropertiesgetClientProperties()
     Returns the properties associated with this client.
 booleangetConfirmationResponse(String message)
    
 CookieJargetCookieJar()
    
public  String[]getCookieNames()
     Returns the name of all the active cookies which will be sent to the server.
public  StringgetCookieValue(String name)
     Returns the value of the specified cookie.
public  WebResponsegetCurrentPage()
     Returns the response representing the current top page in the main window.
public  booleangetExceptionsThrownOnErrorStatus()
     Returns true if an exception will be thrown when an error status (4xx or 5xx) is detected on a response.
public  WebResponsegetFrameContents(String frameName)
     Returns the response associated with the specified frame name in the main window.
public  WebResponsegetFrameContents(FrameSelector targetFrame)
     Returns the response associated with the specified frame name in the main window.
public  String[]getFrameNames()
     Returns the name of the currently active frames in the main window.
public  StringgetHeaderField(String fieldName)
     Returns the value for the header field with the specified name.
protected  DictionarygetHeaderFields(URL targetURL)
     Returns the value of all current header fields.
public  WebWindowgetMainWindow()
    
public  StringgetNextAlert()
     Returns the next javascript alert without removing it from the queue.
public  WebWindowgetOpenWindow(String name)
    
public  WebWindow[]getOpenWindows()
    
public  StringgetProxyHost()
     Returns the name of the active proxy server.
public  intgetProxyPort()
     Returns the number of the active proxy port, or 0 is none is specified.
public  WebResponsegetResource(WebRequest request)
     Returns the resource specified by the request.
public  WebResponsegetResponse(String urlString)
     Submits a GET method request and returns a response.
public  WebResponsegetResponse(WebRequest request)
     Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.
public  StringgetUserAgent()
     Returns the current user agent setting.
 StringgetUserResponse(String message, String defaultResponse)
    
abstract protected  WebResponsenewResponse(WebRequest request, FrameSelector targetFrame)
     Creates a web response object which represents the response to the specified web request.
public  StringpopNextAlert()
     Returns the next javascript alert and removes it from the queue.
 voidpostAlert(String message)
    
public  voidputCookie(String name, String value)
     Defines a cookie to be sent to the server on every request.
public  voidremoveClientListener(WebClientListener listener)
     Removes a listener to watch for requests and responses.
public  voidremoveWindowListener(WebWindowListener listener)
     Removes a listener to watch for window openings and closings.
public  WebResponsesendRequest(WebRequest request)
     Submits a web request and returns a response.
public  voidsetAuthorization(String userName, String password)
     Sets a username and password for a basic authentication scheme.
public  voidsetDialogResponder(DialogResponder responder)
     Specifies the object which will respond to all dialogs.
public  voidsetExceptionsThrownOnErrorStatus(boolean throwExceptions)
     Specifies whether an exception will be thrown when an error status (4xx or 5xx) is detected on a response.
public  voidsetHeaderField(String fieldName, String fieldValue)
     Sets the value for a header field to be sent with all requests.
public  voidsetMainWindow(WebWindow mainWindow)
    
public  voidsetProxyServer(String proxyHost, int proxyPort)
     Specifies a proxy server to use for requests from this client.
public  voidsetProxyServer(String proxyHost, int proxyPort, String userName, String password)
     Specifies a proxy server to use, along with a user and password for authentication.
public  voidsetUserAgent(String userAgent)
     Specifies the user agent identification.
 voidtellListeners(WebRequest request)
    
 voidtellListeners(WebResponse response)
    
 voidupdateClient(WebResponse response)
    
 voidupdateFrameContents(WebWindow requestWindow, String requestTarget, WebResponse response, RequestContext requestContext)
    
final protected  voidupdateMainWindow(FrameSelector frame, WebResponse response)
     Updates this web client based on a received response.
final protected  voidwriteMessageBody(WebRequest request, OutputStream stream)
     Writes the message body for the request.


Constructor Detail
WebClient
protected WebClient()(Code)




Method Detail
addClientListener
public void addClientListener(WebClientListener listener)(Code)
Adds a listener to watch for requests and responses.



addCookie
public void addCookie(String name, String value)(Code)
Defines a cookie to be sent to the server on every request.



addWindowListener
public void addWindowListener(WebWindowListener listener)(Code)
Adds a listener to watch for window openings and closings.



clearContents
public void clearContents()(Code)
Resets the state of this client, removing all cookies, frames, and per-client headers. This does not affect any listeners or preferences which may have been set.



clearProxyServer
public void clearProxyServer()(Code)
Clears the proxy server settings.



close
void close(WebWindow window)(Code)



findFrame
FrameSelector findFrame(String target)(Code)



getClientProperties
public ClientProperties getClientProperties()(Code)
Returns the properties associated with this client.



getConfirmationResponse
boolean getConfirmationResponse(String message)(Code)



getCookieJar
CookieJar getCookieJar()(Code)



getCookieNames
public String[] getCookieNames()(Code)
Returns the name of all the active cookies which will be sent to the server.



getCookieValue
public String getCookieValue(String name)(Code)
Returns the value of the specified cookie.



getCurrentPage
public WebResponse getCurrentPage()(Code)
Returns the response representing the current top page in the main window.



getExceptionsThrownOnErrorStatus
public boolean getExceptionsThrownOnErrorStatus()(Code)
Returns true if an exception will be thrown when an error status (4xx or 5xx) is detected on a response.



getFrameContents
public WebResponse getFrameContents(String frameName)(Code)
Returns the response associated with the specified frame name in the main window. Throws a runtime exception if no matching frame is defined.



getFrameContents
public WebResponse getFrameContents(FrameSelector targetFrame)(Code)
Returns the response associated with the specified frame name in the main window. Throws a runtime exception if no matching frame is defined.
since:
   1.6



getFrameNames
public String[] getFrameNames()(Code)
Returns the name of the currently active frames in the main window.



getHeaderField
public String getHeaderField(String fieldName)(Code)
Returns the value for the header field with the specified name. This method will ignore the case of the field name.



getHeaderFields
protected Dictionary getHeaderFields(URL targetURL)(Code)
Returns the value of all current header fields.



getMainWindow
public WebWindow getMainWindow()(Code)



getNextAlert
public String getNextAlert()(Code)
Returns the next javascript alert without removing it from the queue.



getOpenWindow
public WebWindow getOpenWindow(String name)(Code)



getOpenWindows
public WebWindow[] getOpenWindows()(Code)



getProxyHost
public String getProxyHost()(Code)
Returns the name of the active proxy server.



getProxyPort
public int getProxyPort()(Code)
Returns the number of the active proxy port, or 0 is none is specified.



getResource
public WebResponse getResource(WebRequest request) throws IOException(Code)
Returns the resource specified by the request. Does not update the client or load included framesets or scripts. May return null if the resource is a JavaScript URL which would normally leave the client unchanged.



getResponse
public WebResponse getResponse(String urlString) throws MalformedURLException, IOException, SAXException(Code)
Submits a GET method request and returns a response.
exception:
  SAXException - thrown if there is an error parsing the retrieved page



getResponse
public WebResponse getResponse(WebRequest request) throws MalformedURLException, IOException, SAXException(Code)
Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.
exception:
  SAXException - thrown if there is an error parsing the retrieved page



getUserAgent
public String getUserAgent()(Code)
Returns the current user agent setting.



getUserResponse
String getUserResponse(String message, String defaultResponse)(Code)



newResponse
abstract protected WebResponse newResponse(WebRequest request, FrameSelector targetFrame) throws MalformedURLException, IOException(Code)
Creates a web response object which represents the response to the specified web request.
Parameters:
  request - the request to which the response should be generated
Parameters:
  targetFrame - the frame in which the response should be stored



popNextAlert
public String popNextAlert()(Code)
Returns the next javascript alert and removes it from the queue. If the queue is empty, will return an empty string.



postAlert
void postAlert(String message)(Code)



putCookie
public void putCookie(String name, String value)(Code)
Defines a cookie to be sent to the server on every request. This overrides any previous setting for this cookie name.



removeClientListener
public void removeClientListener(WebClientListener listener)(Code)
Removes a listener to watch for requests and responses.



removeWindowListener
public void removeWindowListener(WebWindowListener listener)(Code)
Removes a listener to watch for window openings and closings.



sendRequest
public WebResponse sendRequest(WebRequest request) throws MalformedURLException, IOException, SAXException(Code)
Submits a web request and returns a response. This is an alternate name for the getResponse method.



setAuthorization
public void setAuthorization(String userName, String password)(Code)
Sets a username and password for a basic authentication scheme.



setDialogResponder
public void setDialogResponder(DialogResponder responder)(Code)
Specifies the object which will respond to all dialogs.



setExceptionsThrownOnErrorStatus
public void setExceptionsThrownOnErrorStatus(boolean throwExceptions)(Code)
Specifies whether an exception will be thrown when an error status (4xx or 5xx) is detected on a response. Defaults to the value returned by HttpUnitOptions.getExceptionsThrownOnErrorStatus.



setHeaderField
public void setHeaderField(String fieldName, String fieldValue)(Code)
Sets the value for a header field to be sent with all requests. If the value set is null, removes the header from those to be sent.



setMainWindow
public void setMainWindow(WebWindow mainWindow)(Code)



setProxyServer
public void setProxyServer(String proxyHost, int proxyPort)(Code)
Specifies a proxy server to use for requests from this client.



setProxyServer
public void setProxyServer(String proxyHost, int proxyPort, String userName, String password)(Code)
Specifies a proxy server to use, along with a user and password for authentication.
since:
   1.6



setUserAgent
public void setUserAgent(String userAgent)(Code)
Specifies the user agent identification. Used to trigger browser-specific server behavior.



tellListeners
void tellListeners(WebRequest request)(Code)



tellListeners
void tellListeners(WebResponse response)(Code)



updateClient
void updateClient(WebResponse response) throws IOException(Code)



updateFrameContents
void updateFrameContents(WebWindow requestWindow, String requestTarget, WebResponse response, RequestContext requestContext) throws IOException, SAXException(Code)



updateMainWindow
final protected void updateMainWindow(FrameSelector frame, WebResponse response) throws MalformedURLException, IOException, SAXException(Code)
Updates this web client based on a received response. This includes updating cookies and frames. This method is required by ServletUnit, which cannot call the updateWindow method directly.



writeMessageBody
final protected void writeMessageBody(WebRequest request, OutputStream stream) throws IOException(Code)
Writes the message body for the request.



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.