org.loom.servlet
Class CacheControl

java.lang.Object
  extended by org.loom.servlet.CacheControl

public class CacheControl
extends java.lang.Object

Contains the caching information related to the response object. This information tells the browser about how it is expected to cache the server response.

Author:
icoloma

Constructor Summary
CacheControl()
           
 
Method Summary
 java.lang.Boolean getCacheNever()
           
 java.lang.Integer getCacheSeconds()
           
 java.lang.String getEtag()
           
 java.util.Date getLastModified()
           
 boolean isResourceModified(LoomServletRequest request)
          Compares this CacheControl data with the request headers, and returns true if the browser page is outdated and a new one should be sent.
 void setCacheForever()
          Sets the response to never expire
 void setCacheNever()
           
 void setCacheSeconds(java.lang.Integer cacheSeconds)
           
 void setEtag(java.lang.String etag)
           
 void setLastModified(java.util.Date lastModified)
           
 void writeHeaders(LoomServletResponse response)
          Write the headers for a 200 (OK) or 304 (NOT_MODIFIED) response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheControl

public CacheControl()
Method Detail

isResourceModified

public boolean isResourceModified(LoomServletRequest request)
Compares this CacheControl data with the request headers, and returns true if the browser page is outdated and a new one should be sent. If false, a 304 could be sent instead. If both lastModified and etag has been specified, this method will return true if any is missing or incorrect in the browser request.

Parameters:
request - the current servlet request
Returns:
true if a new page should be sent, false to send a 304

writeHeaders

public void writeHeaders(LoomServletResponse response)
Write the headers for a 200 (OK) or 304 (NOT_MODIFIED) response.


setCacheForever

public void setCacheForever()
Sets the response to never expire


getLastModified

public java.util.Date getLastModified()

setLastModified

public void setLastModified(java.util.Date lastModified)

getEtag

public java.lang.String getEtag()

setEtag

public void setEtag(java.lang.String etag)

getCacheSeconds

public java.lang.Integer getCacheSeconds()

setCacheSeconds

public void setCacheSeconds(java.lang.Integer cacheSeconds)

getCacheNever

public java.lang.Boolean getCacheNever()

setCacheNever

public void setCacheNever()


The Loom Framework 1.6-SNAPSHOT.
Licensed under the Apache License, Version 2.0 by Extrema Sistemas de Informacion S.L.