org.codehaus.httpcache4j
Class HeaderUtils

java.lang.Object
  extended by org.codehaus.httpcache4j.HeaderUtils

public final class HeaderUtils
extends java.lang.Object

A collection header utilities.


Field Summary
static java.lang.String PATTERN_RFC1123
           
 
Method Summary
static org.joda.time.DateTime fromHttpDate(Header header)
           
static long getHeaderAsDate(Header header)
           
static boolean hasCacheableHeaders(Headers headers)
          From http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4.
static Header toHttpDate(java.lang.String headerName, org.joda.time.DateTime time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_RFC1123

public static final java.lang.String PATTERN_RFC1123
See Also:
Constant Field Values
Method Detail

fromHttpDate

public static org.joda.time.DateTime fromHttpDate(Header header)

toHttpDate

public static Header toHttpDate(java.lang.String headerName,
                                org.joda.time.DateTime time)

getHeaderAsDate

public static long getHeaderAsDate(Header header)

hasCacheableHeaders

public static boolean hasCacheableHeaders(Headers headers)
From http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.4. Unless specifically constrained by a cache-control (section 14.9) directive, a caching system MAY always store a successful response (see section 13.8) as a cache entry, MAY return it without validation if it is fresh, and MAY return it after successful validation. If there is neither a cache validator nor an explicit expiration time associated with a response, we do not expect it to be cached, but certain caches MAY violate this expectation (for example, when little or no network connectivity is available). A client can usually detect that such a response was taken from a cache by comparing the Date header to the current time.

Parameters:
headers - the headers to analyze
Returns:
true if the headers were cacheable, false if not.


Copyright © 2008-2009. All Rights Reserved.