com.meterware.httpunit
public abstract class WebClient extends Object
| Nested Class Summary | |
|---|---|
| static class | WebClient.HeaderDictionary |
| Constructor Summary | |
|---|---|
| protected | WebClient() |
| Method Summary | |
|---|---|
| void | addClientListener(WebClientListener listener)
Adds a listener to watch for requests and responses. |
| void | addCookie(String name, String value)
Defines a cookie to be sent to the server on every request. |
| void | addWindowListener(WebWindowListener listener)
Adds a listener to watch for window openings and closings. |
| void | clearContents()
Resets the state of this client, removing all cookies, frames, and per-client headers. |
| void | clearProxyServer()
Clears the proxy server settings. |
| ClientProperties | getClientProperties()
Returns the properties associated with this client. |
| String[] | getCookieNames()
Returns the name of all the active cookies which will be sent to the server.
|
| String | getCookieValue(String name)
Returns the value of the specified cookie.
|
| WebResponse | getCurrentPage()
Returns the response representing the current top page in the main window. |
| boolean | getExceptionsThrownOnErrorStatus()
Returns true if an exception will be thrown when an error status (4xx or 5xx) is detected on a response.
|
| WebResponse | getFrameContents(String frameName)
Returns the response associated with the specified frame name in the main window.
|
| WebResponse | getFrameContents(FrameSelector targetFrame)
Returns the response associated with the specified frame name in the main window.
|
| String[] | getFrameNames()
Returns the name of the currently active frames in the main window.
|
| String | getHeaderField(String fieldName)
Returns the value for the header field with the specified name. |
| protected Dictionary | getHeaderFields(URL targetURL)
Returns the value of all current header fields.
|
| WebWindow | getMainWindow() |
| String | getNextAlert()
Returns the next javascript alert without removing it from the queue. |
| WebWindow | getOpenWindow(String name) |
| WebWindow[] | getOpenWindows() |
| String | getProxyHost()
Returns the name of the active proxy server. |
| int | getProxyPort()
Returns the number of the active proxy port, or 0 is none is specified. |
| WebResponse | getResource(WebRequest request)
Returns the resource specified by the request. |
| WebResponse | getResponse(String urlString)
Submits a GET method request and returns a response. |
| WebResponse | getResponse(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. |
| String | getUserAgent()
Returns the current user agent setting. |
| protected abstract WebResponse | newResponse(WebRequest request, FrameSelector targetFrame)
Creates a web response object which represents the response to the specified web request. |
| String | popNextAlert()
Returns the next javascript alert and removes it from the queue. |
| void | putCookie(String name, String value)
Defines a cookie to be sent to the server on every request. |
| void | removeClientListener(WebClientListener listener)
Removes a listener to watch for requests and responses. |
| void | removeWindowListener(WebWindowListener listener)
Removes a listener to watch for window openings and closings. |
| WebResponse | sendRequest(WebRequest request)
Submits a web request and returns a response. |
| void | setAuthorization(String userName, String password)
Sets a username and password for a basic authentication scheme.
|
| void | setDialogResponder(DialogResponder responder)
Specifies the object which will respond to all dialogs.
|
| void | setExceptionsThrownOnErrorStatus(boolean throwExceptions)
Specifies whether an exception will be thrown when an error status (4xx or 5xx) is detected on a response.
|
| void | setHeaderField(String fieldName, String fieldValue)
Sets the value for a header field to be sent with all requests. |
| void | setMainWindow(WebWindow mainWindow) |
| void | setProxyServer(String proxyHost, int proxyPort)
Specifies a proxy server to use for requests from this client. |
| void | setProxyServer(String proxyHost, int proxyPort, String userName, String password)
Specifies a proxy server to use, along with a user and password for authentication.
|
| void | setUserAgent(String userAgent)
Specifies the user agent identification. |
| protected void | updateMainWindow(FrameSelector frame, WebResponse response)
Updates this web client based on a received response. |
| protected void | writeMessageBody(WebRequest request, OutputStream stream)
Writes the message body for the request.
|
Deprecated: as of 1.6, use #putCookie instead.
Defines a cookie to be sent to the server on every request.Since: 1.6
Throws: SAXException thrown if there is an error parsing the retrieved page
Throws: SAXException thrown if there is an error parsing the retrieved page
Deprecated: as of 1.4.6. Use ClientProperties#getUserAgent instead.
Returns the current user agent setting.Parameters: request the request to which the response should be generated targetFrame the frame in which the response should be stored
Since: 1.6
Deprecated: as of 1.4.6. Use ClientProperties#setUserAgent instead.
Specifies the user agent identification. Used to trigger browser-specific server behavior.