Package org.htmlunit

Class WebResponseFromCache

All Implemented Interfaces:
Serializable

class WebResponseFromCache extends WebResponseWrapper
A WebResponse implementation to deliver with content from cache. The response is the same but the request may have some variation like an anchor.
  • Field Details

  • Constructor Details

    • WebResponseFromCache

      WebResponseFromCache(WebResponse cachedResponse, List<NameValuePair> overwriteHeaders, WebRequest currentRequest)
      Wraps the provided cached response for a new request.
      Parameters:
      cachedResponse - the response from cache
      overwriteHeaders - list of headers to overwrite cachedResponse headers
      currentRequest - the new request
    • WebResponseFromCache

      WebResponseFromCache(WebResponse cachedResponse, WebRequest currentRequest)
      Wraps the provided response for the given request
      Parameters:
      cachedResponse - the response from cache
      currentRequest - the new request
  • Method Details

    • 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 class WebResponseWrapper
      Returns:
      the request used to load this response
    • getResponseHeaders

      public List<NameValuePair> getResponseHeaders()
      Returns the response headers as a list of NameValuePairs. The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object.
      Overrides:
      getResponseHeaders in class WebResponseWrapper
      Returns:
      the response headers as a list of NameValuePairs
    • getResponseHeaderValue

      public String getResponseHeaderValue(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 class WebResponseWrapper
      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