Package org.htmlunit

Class WebResponseFromCache

  • All Implemented Interfaces:
    java.io.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 Detail

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