com.gargoylesoftware.htmlunit.util
Class DebuggingWebConnection

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.util.WebConnectionWrapper
      extended by com.gargoylesoftware.htmlunit.util.DebuggingWebConnection
All Implemented Interfaces:
WebConnection

public class DebuggingWebConnection
extends WebConnectionWrapper

Wrapper around a "real" WebConnection that will use the wrapped web connection to do the real job and save all received responses in the temp directory with an overview page.

This may be useful at conception time to understand what is "browsed".

Example:

 final WebClient client = new WebClient();
 final WebConnection connection = new DebuggingWebConnection(client.getWebConnection(), "myTest");
 client.setWebConnection(connection);
 
In this example an overview page will be generated under the name myTest.html in the temp directory.

This class is only intended as an help during the conception.

Version:
$Revision: 1.3 $
Author:
Marc Guillemot, Ahmed Ashour

Constructor Summary
DebuggingWebConnection(WebConnection webConnection, java.lang.String reportBaseName)
 Wraps a web connection to have a report generated of the received responses.
 
Method Summary
 WebResponse getResponse(WebRequestSettings webRequestSettings)
 Calls the wrapped webconnection and save the received response.
 
Methods inherited from class com.gargoylesoftware.htmlunit.util.WebConnectionWrapper
getState, getWebClient
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebuggingWebConnection

public DebuggingWebConnection(WebConnection webConnection,
                              java.lang.String reportBaseName)
                       throws java.io.IOException
Wraps a web connection to have a report generated of the received responses.

Parameters:
webConnection - the webConnection that do the real work
reportBaseName - the base name to use for the generated files. The report will be reportBaseName + ".html" in the temp file.
Throws:
java.io.IOException - in case of problems writing the files.
Method Detail

getResponse

public WebResponse getResponse(WebRequestSettings webRequestSettings)
                        throws java.io.IOException
Calls the wrapped webconnection and save the received response. INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Submits a request and retrieves a response. The default behavior of this method is to return getResponse() on the wrapped connection object.

Specified by:
getResponse in interface WebConnection
Overrides:
getResponse in class WebConnectionWrapper
Parameters:
webRequestSettings - Settings to make the request with.
Returns:
The response to the request defined by the specified request settings.
Throws:
java.io.IOException - If an IO error occurs.


Copyright © 2003-2016 AppPerfect Corporation. All Rights Reserved.