public abstract class FalsifyingWebConnection extends WebConnectionWrapper
WebConnectionWrapper providing facility methods to deliver something other than
what the wrapped connection would deliver.| Constructor and Description |
|---|
FalsifyingWebConnection(WebClient webClient)
Constructs an instance and places itself as connection of the WebClient.
|
FalsifyingWebConnection(WebConnection webConnection)
Constructs a WebConnection object wrapping provided WebConnection.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
close, getResponse, getWrappedWebConnectionpublic FalsifyingWebConnection(WebConnection webConnection) throws IllegalArgumentException
webConnection - the webConnection that does the real workIllegalArgumentException - if the connection is nullpublic FalsifyingWebConnection(WebClient webClient) throws IllegalArgumentException
webClient - the WebClient which WebConnection should be wrappedIllegalArgumentException - if the WebClient is nullprotected WebResponse deliverFromAlternateUrl(WebRequest webRequest, URL url) throws IOException
webRequest - the original web requesturl - the URL from which the content should be retrievedIOException - if a problem occurredprotected WebResponse replaceContent(WebResponse wr, String newContent) throws IOException
wr - the web response to adaptnewContent - the new content to place in the responseIOException - if an encoding problem occurredprotected 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 responseIOException - if an encoding problem occurredprotected 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 responseIOException - if an encoding problem occurredCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.