org.w3c.www.http
Class HttpCacheControl

java.lang.Object
  extended by org.w3c.www.http.BasicValue
      extended by org.w3c.www.http.HttpCacheControl
All Implemented Interfaces:
java.lang.Cloneable, HeaderValue

public class HttpCacheControl
extends BasicValue

The parsed cache-control directive of HTTP/1.1 This object gives access to the parsed value of the cache-control directive of HTTP/1.1, as defined in section 14.9 of the specification.


Field Summary
 
Fields inherited from class org.w3c.www.http.BasicValue
isValid, raw, rlen, roff
 
Constructor Summary
HttpCacheControl()
          Create a new empty cache control object descriptor.
 
Method Summary
 void addNoCache(java.lang.String name)
          Add the given header name to the no-cache directive.
 boolean checkMustRevalidate()
          Is the must-revalidate flag set ?
 boolean checkNoStore()
          Is the no-store flag set ?
 boolean checkNoTransform()
          Is the no-transform flag set ?
 boolean checkOnlyIfCached()
          Is the on-if-cached flag value set ?
 boolean checkProxyRevalidate()
          Is the proxy-revalidate flag set ?
 boolean checkPublic()
          Is the public flag set ?
 int getMaxAge()
          Get the max-age value defined by this cache control policy.
 int getMaxStale()
          Get the max-stale value defined by this control object.
 int getMinFresh()
          Get the min-fresh directive value.
 java.lang.String[] getNoCache()
          Get and test the no-cache directive setting.
 java.lang.String[] getPrivate()
          Check and get the private value.
 int getSMaxAge()
          Get the s-maxage value defined by this cache control policy.
 java.lang.Object getValue()
          HeaderValue implementation - Get this header value.
protected  void parse()
          parse.
 void setMaxAge(int age)
          Set the max-age directive for this cache control.
 void setMaxStale(int stale)
          Set the max-stale directive value.
 void setMinFresh(int fresh)
          Set the minfresh directive value.
 void setMustRevalidate(boolean onoff)
          Set the must-revalidate directive.
 void setNoCache()
          Set the no-cache directive globally.
 void setNoCache(java.lang.String[] fields)
          Set the no cache directive to the given list of fields.
 void setNoStore(boolean onoff)
          Set the no-store flag.
 void setNoTransform(boolean onoff)
          Set the no-transform directive.
 void setOnlyIfCached(boolean onoff)
          Set the only-if-cached directive.
 void setPrivate(java.lang.String[] priv)
          Set the private directive value.
 void setProxyRevalidate(boolean onoff)
          Set the proxy-revalidate directive.
 void setPublic(boolean onoff)
          Set the public directive.
 void setSMaxAge(int age)
          Set the s_maxage directive for this cache control.
 void unsetNoCache()
          Unset the no-cache directive.
 void unsetPrivate()
          Unset the private directive.
protected  void updateByteValue()
          Recompute the byte value for this header.
 
Methods inherited from class org.w3c.www.http.BasicValue
addBytes, appendValue, checkByteValue, clone, emit, error, invalidateByteValue, setBytes, setString, toExternalForm, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpCacheControl

public HttpCacheControl()
Create a new empty cache control object descriptor. The value will be provided through parsing.

Method Detail

updateByteValue

protected void updateByteValue()
Recompute the byte value for this header.

Specified by:
updateByteValue in class BasicValue

parse

protected void parse()
              throws HttpParserException
parse.

Specified by:
parse in class BasicValue
Throws:
HttpParserException - if parsing failed.

getValue

public java.lang.Object getValue()
HeaderValue implementation - Get this header value.

Specified by:
getValue in interface HeaderValue
Specified by:
getValue in class BasicValue
Returns:
Itself !

getNoCache

public java.lang.String[] getNoCache()
Get and test the no-cache directive setting.

Returns:
A field-list as an array of String, or null if the directive is undefined.

setNoCache

public void setNoCache(java.lang.String[] fields)
Set the no cache directive to the given list of fields.

Parameters:
fields - The fields to set in the no-cache directive, encoded as a String array (whose length can be 0), or null to reset the value.

setNoCache

public void setNoCache()
Set the no-cache directive globally.


addNoCache

public void addNoCache(java.lang.String name)
Add the given header name to the no-cache directive.

Parameters:
name - The header name to add.

unsetNoCache

public void unsetNoCache()
Unset the no-cache directive.


checkNoStore

public boolean checkNoStore()
Is the no-store flag set ?

Returns:
A boolean.

setNoStore

public void setNoStore(boolean onoff)
Set the no-store flag.

Parameters:
onoff - The value for the no-store directive.

getMaxAge

public final int getMaxAge()
Get the max-age value defined by this cache control policy.

Returns:
The max-age value, or -1 if undefined.

setMaxAge

public void setMaxAge(int age)
Set the max-age directive for this cache control.

Parameters:
age - The max allowed age for the cache control policy, or -1 to reset value.

getSMaxAge

public final int getSMaxAge()
Get the s-maxage value defined by this cache control policy.

Returns:
The s-maxage value, or -1 if undefined.

setSMaxAge

public void setSMaxAge(int age)
Set the s_maxage directive for this cache control.

Parameters:
age - The max allowed age for the cache control policy, or -1 to reset value.

getMaxStale

public int getMaxStale()
Get the max-stale value defined by this control object.

Returns:
The max-stale value, or -1 if undefined.

setMaxStale

public void setMaxStale(int stale)
Set the max-stale directive value.

Parameters:
stale - The max-stale value, or -1 to reset value.

getMinFresh

public int getMinFresh()
Get the min-fresh directive value.

Parameters:
def - The default value to reurn if undefined.

setMinFresh

public void setMinFresh(int fresh)
Set the minfresh directive value.

Parameters:
fresh - The new minfresh value, or -1 to reset value.

checkOnlyIfCached

public boolean checkOnlyIfCached()
Is the on-if-cached flag value set ?

Returns:
A boolean.

setOnlyIfCached

public void setOnlyIfCached(boolean onoff)
Set the only-if-cached directive.

Parameters:
onoff - The boolean value for the directive.

checkPublic

public boolean checkPublic()
Is the public flag set ?

Returns:
A boolean.

setPublic

public void setPublic(boolean onoff)
Set the public directive.

Parameters:
onoff - The public directive value.

getPrivate

public java.lang.String[] getPrivate()
Check and get the private value.

Parameters:
def - The default value if undefined.
Returns:
A list of field-names, as a String array, or the provided default value otherwise.

setPrivate

public void setPrivate(java.lang.String[] priv)
Set the private directive value.

Parameters:
priv - The list of field-names as a String array.

unsetPrivate

public void unsetPrivate()
Unset the private directive.


checkNoTransform

public boolean checkNoTransform()
Is the no-transform flag set ?

Returns:
A boolean.

setNoTransform

public void setNoTransform(boolean onoff)
Set the no-transform directive.

Parameters:
onoff - The new boolean value for the no-transform directive.

checkMustRevalidate

public boolean checkMustRevalidate()
Is the must-revalidate flag set ?

Returns:
A boolean.

setMustRevalidate

public void setMustRevalidate(boolean onoff)
Set the must-revalidate directive.

Parameters:
onoff - The new value for the must-revalidate directive.

checkProxyRevalidate

public boolean checkProxyRevalidate()
Is the proxy-revalidate flag set ?

Returns:
A boolean.

setProxyRevalidate

public void setProxyRevalidate(boolean onoff)
Set the proxy-revalidate directive.

Parameters:
onoff - The new proxy-revalidate value.