eu.europa.tmsearch.services.resources.util
Class CacheableResponseSupport

java.lang.Object
  extended by eu.europa.tmsearch.services.resources.util.CacheableResponseSupport
Direct Known Subclasses:
ApplicantResource, RepresentativeResource, TradeMarkImageResource, TradeMarkResource, TradeMarkThumbnailResource

public abstract class CacheableResponseSupport
extends java.lang.Object

Convenience super class for creating cacheable HTTP responses.


Constructor Summary
CacheableResponseSupport()
           
 
Method Summary
 javax.ws.rs.core.Response checkForStaleResource(javax.ws.rs.core.Request request)
          Checks if the resource hold by the client is expired
 javax.ws.rs.core.Response checkForValidResource(javax.ws.rs.core.Request request)
          Checks if the resource hold by the client is valid (expired but not changed)
 javax.xml.datatype.XMLGregorianCalendar getDateTimeStamp(java.util.Date date)
           
 ETagGenerator getETagGenerator()
           
 java.util.Date getExpires()
           
 java.util.Date getLastModified()
           
 ETagGenerator setETagGenerator(ETagGenerator tagGenerator)
           
 void setExpires(java.util.Date expires)
           
 void setLastModified(java.util.Date lastModified)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheableResponseSupport

public CacheableResponseSupport()
Method Detail

checkForStaleResource

public javax.ws.rs.core.Response checkForStaleResource(javax.ws.rs.core.Request request)
Checks if the resource hold by the client is expired

Parameters:
request - Jersey request
lastModified - Server-side last modified timestamp for the resource the client is requesting
Returns:
Null if not server-side last modified timestamp is provided. Null if the client-side resource is expired. An HTTP 304 error if client-side resource is not expired.

checkForValidResource

public javax.ws.rs.core.Response checkForValidResource(javax.ws.rs.core.Request request)
Checks if the resource hold by the client is valid (expired but not changed)

Parameters:
request -
eTag - Server-side eTag for the resource the client is requesting
Returns:
Null if not server-side eTag is provided. Null if the client-side resource is no longer valid. An HTTP 304 error if client-side resource is still valid.

getDateTimeStamp

public javax.xml.datatype.XMLGregorianCalendar getDateTimeStamp(java.util.Date date)

setETagGenerator

public ETagGenerator setETagGenerator(ETagGenerator tagGenerator)

getETagGenerator

public ETagGenerator getETagGenerator()

getLastModified

public java.util.Date getLastModified()

setLastModified

public void setLastModified(java.util.Date lastModified)

getExpires

public java.util.Date getExpires()

setExpires

public void setExpires(java.util.Date expires)


Copyright © 2009. All Rights Reserved.