|
||||||||||
| 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.FalsifyingWebConnection
public abstract class FalsifyingWebConnection
Extension of WebConnectionWrapper providing facility methods to deliver something other than
what the wrapped connection would deliver.
| Constructor Summary | |
|---|---|
FalsifyingWebConnection(WebClient webClient)
Constructs an instance and places itself as connection of the WebClient. |
|
FalsifyingWebConnection(WebConnection webConnection)
Constructs a WebConnection object wrapping provided WebConnection. |
|
| Method Summary | |
|---|---|
protected WebResponse |
createWebResponse(WebRequest wr,
String content,
String contentType)
Creates a faked WebResponse for the request with the provided content. |
protected WebResponse |
createWebResponse(WebRequest wr,
String content,
String contentType,
int responseCode,
String responseMessage)
Creates a faked WebResponse for the request with the provided content. |
protected WebResponse |
deliverFromAlternateUrl(WebRequest webRequest,
URL url)
Delivers the content for an alternate URL as if it comes from the requested URL. |
protected WebResponse |
replaceContent(WebResponse wr,
String newContent)
Builds a WebResponse with new content, preserving all other information. |
| Methods inherited from class com.gargoylesoftware.htmlunit.util.WebConnectionWrapper |
|---|
getResponse |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FalsifyingWebConnection(WebConnection webConnection)
throws IllegalArgumentException
webConnection - the webConnection that does the real work
IllegalArgumentException - if the connection is null
public FalsifyingWebConnection(WebClient webClient)
throws IllegalArgumentException
webClient - the WebClient which WebConnection should be wrapped
IllegalArgumentException - if the WebClient is null| Method Detail |
|---|
protected WebResponse deliverFromAlternateUrl(WebRequest webRequest,
URL url)
throws IOException
webRequest - the original web requesturl - the URL from which the content should be retrieved
IOException - if a problem occurred
protected WebResponse replaceContent(WebResponse wr,
String newContent)
throws IOException
wr - the web response to adaptnewContent - the new content to place in the response
IOException - if an encoding problem occurred
protected WebResponse createWebResponse(WebRequest wr,
String content,
String contentType)
throws IOException
wr - the web request for which a response should be createdcontent - the content to place in the responsecontentType - the content type of the response
IOException - if an encoding problem occurred
protected WebResponse createWebResponse(WebRequest wr,
String content,
String contentType,
int responseCode,
String responseMessage)
throws IOException
wr - the web request for which a response should be createdcontent - the content to place in the responsecontentType - the content type of the responseresponseCode - the HTTP code for the responseresponseMessage - the HTTP message for the response
IOException - if an encoding problem occurred
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||