|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.util.WebConnectionWrapper
com.gargoylesoftware.htmlunit.util.DebuggingWebConnection
public class DebuggingWebConnection
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/index.html in the temp directory and all received responses will be saved int the myTest folder.
Constructor Summary | |
---|---|
DebuggingWebConnection(WebConnection webConnection,
java.lang.String dirName)
Wraps a web connection to have a report generated of the received responses. |
Method Summary | |
---|---|
void |
addMark(java.lang.String mark)
Adds a mark that will be visible in the HTML result page generated by this class. |
WebResponse |
getResponse(WebRequestSettings settings)
Calls the wrapped webconnection and save the received response. |
protected void |
saveResponse(WebResponse response,
WebRequestSettings settings)
Saves the response content in the temp dir and adds it to the summary page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DebuggingWebConnection(WebConnection webConnection, java.lang.String dirName) throws java.io.IOException
webConnection
- the webConnection that do the real workdirName
- the name of the directory to create in the tmp folder to save received responses.
If this folder already exists, it will be deleted first.
java.io.IOException
- in case of problems writing the filesMethod Detail |
---|
public WebResponse getResponse(WebRequestSettings settings) throws java.io.IOException
getResponse
in interface WebConnection
getResponse
in class WebConnectionWrapper
settings
- Settings to make the request with
java.io.IOException
- if an IO error occurspublic void addMark(java.lang.String mark) throws java.io.IOException
mark
- the text
java.io.IOException
- if a problem occurs writing the fileprotected void saveResponse(WebResponse response, WebRequestSettings settings) throws java.io.IOException
response
- the response to savesettings
- the settings used to get the response
java.io.IOException
- if a problem occurs writing the file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |