public class CacheResponseContext extends Object
| Constructor and Description |
|---|
CacheResponseContext(com.sun.jersey.api.core.HttpResponseContext httpContext) |
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.CacheControl |
getCacheControl()
Get the cache control options specified in the response.
|
com.google.common.base.Optional<org.joda.time.DateTime> |
getDate()
Get the
HttpHeaders.DATE HTTP header. |
com.sun.jersey.api.core.HttpResponseContext |
getHttpContext() |
int |
getSharedCacheMaxAge()
Get the max time, in seconds, the response should be served from a shared cache or -1 if no max age has been set.
|
int |
getStatusCode()
Get the HTTP response status code (e.g.
|
void |
setAge(org.joda.time.DateTime start,
org.joda.time.DateTime end)
Set the
HttpHeaders.AGE HTTP header as the difference between two instants
(end - start). |
void |
setAge(int seconds)
Set the
HttpHeaders.AGE HTTP header. |
void |
setDate(org.joda.time.DateTime date)
Set the
HttpHeaders.DATE HTTP header. |
void |
setExpires(org.joda.time.DateTime date)
Set the
HttpHeaders.EXPIRES HTTP header. |
public CacheResponseContext(com.sun.jersey.api.core.HttpResponseContext httpContext)
public com.sun.jersey.api.core.HttpResponseContext getHttpContext()
public int getStatusCode()
public javax.ws.rs.core.CacheControl getCacheControl()
CacheControl is mutable, the returned value should be treated as immutable.public int getSharedCacheMaxAge()
public com.google.common.base.Optional<org.joda.time.DateTime> getDate()
HttpHeaders.DATE HTTP header.public void setDate(org.joda.time.DateTime date)
HttpHeaders.DATE HTTP header.date - instant to set the date header topublic void setExpires(org.joda.time.DateTime date)
HttpHeaders.EXPIRES HTTP header.date - instant to set the expires header topublic void setAge(org.joda.time.DateTime start,
org.joda.time.DateTime end)
HttpHeaders.AGE HTTP header as the difference between two instants
(end - start).
Sets the age to 0 if end < start.start - starting instantend - ending instantpublic void setAge(int seconds)
HttpHeaders.AGE HTTP header.seconds - number of seconds to set the header to (>= 0)Copyright © 2014. All Rights Reserved.