org.apache.pluto.internal.impl
Class CacheControlImpl

java.lang.Object
  extended by org.apache.pluto.internal.impl.CacheControlImpl
All Implemented Interfaces:
CacheControl

public class CacheControlImpl
extends java.lang.Object
implements CacheControl

Implementation of JSR-286 CacheControl.

Since:
2.0 TODO: Implement this class ;-)

Constructor Summary
CacheControlImpl()
           
 
Method Summary
 java.lang.String getETag()
          Returns the ETag for the current response that is used as validation tag, or null if no ETag is set on the response.
 int getExpirationTime()
          Get the currently set expiration time.
 boolean isPublicScope()
          Returns a boolean indicating whether the caching scope is set to public for the current response.
 void setETag(java.lang.String arg0)
          Sets an ETag for the current response that is used as validation tag.
 void setExpirationTime(int arg0)
          Sets a new expiration time for the current response in seconds.
 void setPublicScope(boolean arg0)
          Sets the caching scope for the current response to public with true as publicScope and to private with false as publicScope.
 void setUseCachedContent(boolean arg0)
          Sets the indication whether the cached content for the provided ETag at the request is still valid or not.
 boolean useCachedContent()
          Returns a boolean indicating whether the cached content for the provided ETag at the request can still be considerated valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheControlImpl

public CacheControlImpl()
Method Detail

getETag

public java.lang.String getETag()
Description copied from interface: CacheControl
Returns the ETag for the current response that is used as validation tag, or null if no ETag is set on the response.

This call is equivalent to calling getProperty(ETAG).

Specified by:
getETag in interface CacheControl
Returns:
the ETag for the current response that is used as validation tag, or null if no ETag is set.

getExpirationTime

public int getExpirationTime()
Description copied from interface: CacheControl
Get the currently set expiration time. If no expiration time is set on this response the default defined in the portlet deployment descriptor with the expiration-cache tag is returned, or 0 if no default is defined.

This call returns the same value as the getProperty(EXPIRATION_CACHE) call.

Specified by:
getExpirationTime in interface CacheControl
Returns:
the currently set expiration time in seconds, or 0 if no expiration time is set.

isPublicScope

public boolean isPublicScope()
Description copied from interface: CacheControl
Returns a boolean indicating whether the caching scope is set to public for the current response. If no caching scope is set on this response, the default defined in the deployment descriptor with the cache-scope tag is returned, or false if no default is defined.

Public cache scope indicates that the cache entry can be shared across users. Non-public, or private cache scope indicates that the cache entry must not be shared across users.

This call is equivalent to calling getProperty(CACHE_SCOPE).equals(PUBLIC_SCOPE).

Specified by:
isPublicScope in interface CacheControl
Returns:
true if the cache scope is public for the current response.

setETag

public void setETag(java.lang.String arg0)
Description copied from interface: CacheControl
Sets an ETag for the current response that is used as validation tag. If an ETag was already set it is replaced with the new value.

This call is equivalent to calling setProperty(ETAG, token).

Setting the ETag to null removes the currently set ETag.

Specified by:
setETag in interface CacheControl
Parameters:
arg0 - the ETag token

setExpirationTime

public void setExpirationTime(int arg0)
Description copied from interface: CacheControl
Sets a new expiration time for the current response in seconds.

If the expiration value is set to 0, caching is disabled for this portlet; if the value is set to -1, the cache does not expire.

This call is equivalent to calling setProperty(EXPIRATION_CACHE).

Specified by:
setExpirationTime in interface CacheControl
Parameters:
arg0 - expiration time in seconds

setPublicScope

public void setPublicScope(boolean arg0)
Description copied from interface: CacheControl
Sets the caching scope for the current response to public with true as publicScope and to private with false as publicScope.

Public cache scope indicates that the cache entry can be shared across users. Non-public, or private cache scope indicates that the cache entry must not be shared across users.

This call is equivalent to calling (publicScope ? setProperty(CACHE_SCOPE, PUBLIC_SCOPE | setProperty(CACHE_SCOPE, PRIVATE_SCOPE).

Specified by:
setPublicScope in interface CacheControl
Parameters:
arg0 - indicating if the cache entry can be shared across users

setUseCachedContent

public void setUseCachedContent(boolean arg0)
Description copied from interface: CacheControl
Sets the indication whether the cached content for the provided ETag at the request is still valid or not. If set to true no output should be rendered, but a new expiration time should be set for the markup with the given ETag .

This call is equivalent to calling setProperty(USE_CACHED_CONTENT, "true").

Specified by:
setUseCachedContent in interface CacheControl

useCachedContent

public boolean useCachedContent()
Description copied from interface: CacheControl
Returns a boolean indicating whether the cached content for the provided ETag at the request can still be considerated valid. If not set, the default is false.

This call is equivalent to calling getProperty(USE_CACHED_CONTENT) and getting a non-null value back.

Specified by:
useCachedContent in interface CacheControl
Returns:
boolean indicating whether the caching scope is set to public for the current response


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.