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
AWebResponse
implementation 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 WebRequest
request_
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 ofNameValuePair
s.java.lang.String
getResponseHeaderValue(java.lang.String headerName)
Returns the value of the specified response header.WebRequest
getWebRequest()
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:
getWebRequest
in classWebResponseWrapper
- Returns:
- the request used to load this response
-
getResponseHeaders
public java.util.List<NameValuePair> getResponseHeaders()
Returns the response headers as a list ofNameValuePair
s. The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object.- Overrides:
getResponseHeaders
in classWebResponseWrapper
- Returns:
- the response headers as a list of
NameValuePair
s
-
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:
getResponseHeaderValue
in classWebResponseWrapper
- Parameters:
headerName
- the name of the header whose value is to be returned- Returns:
- the header value,
null
if no response header exists with this name
-
-