net.rossillo.spring.web.mvc
Enum CachePolicy

java.lang.Object
  extended by java.lang.Enum<CachePolicy>
      extended by net.rossillo.spring.web.mvc.CachePolicy
All Implemented Interfaces:
Serializable, Comparable<CachePolicy>

public enum CachePolicy
extends Enum<CachePolicy>

Provides an enumeration of cache control policies.

Author:
Scott Rossillo

Enum Constant Summary
MUST_REVALIDATE
          Tells caches that they must obey any freshness information you give them.
NO_CACHE
          Forces caches to submit the request to the origin server for validation before releasing a cached copy.
NO_STORE
          Instructs caches not to keep a copy of the representation under any conditions.
PRIVATE
          Allows caches that are specific to one user (e.g., in a browser) to store the response; shared caches (e.g., in a proxy) may not.
PROXY_REVALIDATE
          Similar to MUST_REVALIDATE, except that it only applies to proxy caches.
PUBLIC
          Marks authenticated responses as cacheable.
 
Method Summary
 String policy()
          Returns the HTTP cache-control header value for this policy.
static CachePolicy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CachePolicy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NO_CACHE

public static final CachePolicy NO_CACHE
Forces caches to submit the request to the origin server for validation before releasing a cached copy. Useful to assure that authentication is respected (in combination with public), or to maintain rigid freshness, without sacrificing all of the benefits of caching.


NO_STORE

public static final CachePolicy NO_STORE
Instructs caches not to keep a copy of the representation under any conditions.


MUST_REVALIDATE

public static final CachePolicy MUST_REVALIDATE
Tells caches that they must obey any freshness information you give them. HTTP allows caches to serve stale representations under special conditions; by specifying this policy, you're telling the cache that you want it to strictly follow your rules.


PROXY_REVALIDATE

public static final CachePolicy PROXY_REVALIDATE
Similar to MUST_REVALIDATE, except that it only applies to proxy caches.


PRIVATE

public static final CachePolicy PRIVATE
Allows caches that are specific to one user (e.g., in a browser) to store the response; shared caches (e.g., in a proxy) may not.


PUBLIC

public static final CachePolicy PUBLIC
Marks authenticated responses as cacheable. Normally, if HTTP authentication is required, responses are automatically private.

Method Detail

values

public static CachePolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CachePolicy c : CachePolicy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CachePolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

policy

public String policy()
Returns the HTTP cache-control header value for this policy.



Copyright © 2015. All rights reserved.