public class DebuggingWebConnection extends WebConnectionWrapper
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.
Constructor and Description |
---|
DebuggingWebConnection(WebConnection webConnection,
String reportBaseName)
Wraps a web connection to have a report generated of the received responses.
|
Modifier and Type | Method and Description |
---|---|
WebResponse |
getResponse(WebRequestSettings webRequestSettings)
Calls the wrapped webconnection and save the received response.
|
protected void |
saveResponse(WebResponse response,
WebRequestSettings settings)
Save the response content in the temp dir and add it to the summary page
|
getState, getWebClient
public DebuggingWebConnection(WebConnection webConnection, String reportBaseName) throws IOException
webConnection
- the webConnection that do the real workreportBaseName
- the base name to use for the generated files.
The report will be reportBaseName + ".html" in the temp file.IOException
- in case of problems writing the files.public WebResponse getResponse(WebRequestSettings webRequestSettings) throws IOException
getResponse
in interface WebConnection
getResponse
in class WebConnectionWrapper
webRequestSettings
- Settings to make the request with.IOException
- If an IO error occurs.protected void saveResponse(WebResponse response, WebRequestSettings settings) throws IOException
response
- the response to savesettings
- the settings used to get the responseIOException
- if a problem occurs writing the fileCopyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.