Package org.htmlunit
Class WebResponseFromCache
- java.lang.Object
-
- org.htmlunit.WebResponse
-
- org.htmlunit.util.WebResponseWrapper
-
- org.htmlunit.WebResponseFromCache
-
- All Implemented Interfaces:
java.io.Serializable
class WebResponseFromCache extends WebResponseWrapper
AWebResponseimplementation to deliver with content from cache. The response is the same but the request may have some variation like an anchor.
-
-
Field Summary
Fields Modifier and Type Field Description private WebRequestrequest_private java.util.List<NameValuePair>responseHeaders_
-
Constructor Summary
Constructors Constructor Description WebResponseFromCache(WebResponse cachedResponse, java.util.List<NameValuePair> overwriteHeaders, WebRequest currentRequest)Wraps the provided cached response for a new request.WebResponseFromCache(WebResponse cachedResponse, WebRequest currentRequest)Wraps the provided response for the given request
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<NameValuePair>getResponseHeaders()Returns the response headers as a list ofNameValuePairs.java.lang.StringgetResponseHeaderValue(java.lang.String headerName)Returns the value of the specified response header.WebRequestgetWebRequest()Returns the request used to load this response.-
Methods inherited from class org.htmlunit.util.WebResponseWrapper
cleanUp, defaultCharsetUtf8, getContentAsStream, getContentAsStreamWithBomIfApplicable, getContentAsString, getContentAsString, getContentCharset, getContentCharsetOrNull, getContentLength, getContentType, getHeaderContentCharset, getLoadTime, getStatusCode, getStatusMessage, isSuccess, isSuccessOrUseProxy, isSuccessOrUseProxyOrNotModified, wasContentCharsetTentative
-
Methods inherited from class org.htmlunit.WebResponse
getBlockReason, markAsBlocked, wasBlocked
-
-
-
-
Field Detail
-
request_
private final WebRequest request_
-
responseHeaders_
private final java.util.List<NameValuePair> responseHeaders_
-
-
Constructor Detail
-
WebResponseFromCache
WebResponseFromCache(WebResponse cachedResponse, java.util.List<NameValuePair> overwriteHeaders, WebRequest currentRequest)
Wraps the provided cached response for a new request.- Parameters:
cachedResponse- the response from cacheoverwriteHeaders- list of headers to overwrite cachedResponse headerscurrentRequest- the new request
-
WebResponseFromCache
WebResponseFromCache(WebResponse cachedResponse, WebRequest currentRequest)
Wraps the provided response for the given request- Parameters:
cachedResponse- the response from cachecurrentRequest- the new request
-
-
Method Detail
-
getWebRequest
public WebRequest getWebRequest()
Returns the request used to load this response. The default behavior of this method is to return getWebRequest() on the wrapped webResponse object.- Overrides:
getWebRequestin classWebResponseWrapper- Returns:
- the request used to load this response
-
getResponseHeaders
public java.util.List<NameValuePair> getResponseHeaders()
Returns the response headers as a list ofNameValuePairs. The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object.- Overrides:
getResponseHeadersin classWebResponseWrapper- Returns:
- the response headers as a list of
NameValuePairs
-
getResponseHeaderValue
public java.lang.String getResponseHeaderValue(java.lang.String headerName)
Returns the value of the specified response header. The default behavior of this method is to return getResponseHeaderValue() on the wrapped webResponse object.- Overrides:
getResponseHeaderValuein classWebResponseWrapper- Parameters:
headerName- the name of the header whose value is to be returned- Returns:
- the header value,
nullif no response header exists with this name
-
-