com.koushikdutta.async.http.libcore
Class ResponseHeaders

java.lang.Object
  extended by com.koushikdutta.async.http.libcore.ResponseHeaders

public final class ResponseHeaders
extends java.lang.Object

Parsed HTTP response headers.


Constructor Summary
ResponseHeaders(java.net.URI uri, RawHeaders headers)
           
 
Method Summary
 ResponseSource chooseResponseSource(long nowMillis, RequestHeaders request)
          Returns the source to satisfy request given this cached response.
 ResponseHeaders combine(ResponseHeaders network)
          Combines this cached header with a network header as defined by RFC 2616, 13.5.3.
 java.lang.String getConnection()
           
 java.lang.String getContentEncoding()
           
 int getContentLength()
           
 java.lang.String getEtag()
           
 java.util.Date getExpires()
           
 RawHeaders getHeaders()
           
 java.util.Date getLastModified()
           
 int getMaxAgeSeconds()
           
 java.lang.String getProxyAuthenticate()
           
 java.util.Date getServedDate()
           
 int getSMaxAgeSeconds()
           
 java.net.URI getUri()
           
 java.util.Set<java.lang.String> getVaryFields()
           
 java.lang.String getWwwAuthenticate()
           
 boolean hasConnectionClose()
           
 boolean hasVaryAll()
          Returns true if a Vary header contains an asterisk.
 boolean isCacheable(RequestHeaders request)
          Returns true if this response can be stored to later serve another request.
 boolean isChunked()
           
 boolean isContentEncodingGzip()
           
 boolean isMustRevalidate()
           
 boolean isNoCache()
           
 boolean isNoStore()
           
 boolean isPublic()
           
 void setLocalTimestamps(long sentRequestMillis, long receivedResponseMillis)
           
 void stripContentEncoding()
           
 boolean validate(ResponseHeaders networkResponse)
          Returns true if this cached response should be used; false if the network response should be used.
 boolean varyMatches(java.util.Map<java.lang.String,java.util.List<java.lang.String>> cachedRequest, java.util.Map<java.lang.String,java.util.List<java.lang.String>> newRequest)
          Returns true if none of the Vary headers on this response have changed between cachedRequest and newRequest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseHeaders

public ResponseHeaders(java.net.URI uri,
                       RawHeaders headers)
Method Detail

isContentEncodingGzip

public boolean isContentEncodingGzip()

stripContentEncoding

public void stripContentEncoding()

isChunked

public boolean isChunked()

hasConnectionClose

public boolean hasConnectionClose()

getUri

public java.net.URI getUri()

getHeaders

public RawHeaders getHeaders()

getServedDate

public java.util.Date getServedDate()

getLastModified

public java.util.Date getLastModified()

getExpires

public java.util.Date getExpires()

isNoCache

public boolean isNoCache()

isNoStore

public boolean isNoStore()

getMaxAgeSeconds

public int getMaxAgeSeconds()

getSMaxAgeSeconds

public int getSMaxAgeSeconds()

isPublic

public boolean isPublic()

isMustRevalidate

public boolean isMustRevalidate()

getEtag

public java.lang.String getEtag()

getVaryFields

public java.util.Set<java.lang.String> getVaryFields()

getContentEncoding

public java.lang.String getContentEncoding()

getContentLength

public int getContentLength()

getConnection

public java.lang.String getConnection()

getProxyAuthenticate

public java.lang.String getProxyAuthenticate()

getWwwAuthenticate

public java.lang.String getWwwAuthenticate()

setLocalTimestamps

public void setLocalTimestamps(long sentRequestMillis,
                               long receivedResponseMillis)

isCacheable

public boolean isCacheable(RequestHeaders request)
Returns true if this response can be stored to later serve another request.


hasVaryAll

public boolean hasVaryAll()
Returns true if a Vary header contains an asterisk. Such responses cannot be cached.


varyMatches

public boolean varyMatches(java.util.Map<java.lang.String,java.util.List<java.lang.String>> cachedRequest,
                           java.util.Map<java.lang.String,java.util.List<java.lang.String>> newRequest)
Returns true if none of the Vary headers on this response have changed between cachedRequest and newRequest.


chooseResponseSource

public ResponseSource chooseResponseSource(long nowMillis,
                                           RequestHeaders request)
Returns the source to satisfy request given this cached response.


validate

public boolean validate(ResponseHeaders networkResponse)
Returns true if this cached response should be used; false if the network response should be used.


combine

public ResponseHeaders combine(ResponseHeaders network)
Combines this cached header with a network header as defined by RFC 2616, 13.5.3.