public abstract class FalsifyingWebConnection extends WebConnectionWrapper
WebConnectionWrapper
providing facility methods to deliver something else 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 |
deliverFromAlternateUrl(WebRequestSettings webRequestSettings,
URL url)
Delivers the content for an alternate url as if it would come from the requested one
|
protected WebResponse |
replaceContent(WebResponse webResponse,
String newContent)
Builds a WebResponse with a new content preserving the other informations
|
getResponse, getState, getWebClient
public FalsifyingWebConnection(WebConnection webConnection) throws IllegalArgumentException
webConnection
- the webConnection that does the real workIllegalArgumentException
- if the connection is null
public FalsifyingWebConnection(WebClient webClient) throws IllegalArgumentException
webClient
- the WebClient which WebConnection should be wrappedIllegalArgumentException
- if the WebClient is null
protected WebResponse deliverFromAlternateUrl(WebRequestSettings webRequestSettings, URL url) throws IOException
webRequestSettings
- the original web request settingsurl
- the url from which the content should be retrievedIOException
- if a problem occurredprotected WebResponse replaceContent(WebResponse webResponse, String newContent) throws IOException
webResponse
- the web response to adaptnewContent
- the new content to place in the responseIOException
- if an encoding problem occurredCopyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.