|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.web.servlet.handler.HandlerInterceptorAdapter
net.rossillo.spring.web.mvc.CacheControlHandlerInterceptor
public class CacheControlHandlerInterceptor
Provides a cache control handler interceptor to assign cache-control headers to HTTP responses.
| Constructor Summary | |
|---|---|
CacheControlHandlerInterceptor()
Creates a new cache control handler interceptor. |
|
| Method Summary | |
|---|---|
protected void |
assignCacheControlHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
Assigns a CacheControl header to the given response. |
protected String |
createCacheControlHeader(CacheControl cacheControl)
Returns cache control header value from the given CacheControl
annotation. |
protected long |
createExpiresHeader(CacheControl cacheControl)
Returns an expires header value generated from the given CacheControl annotation. |
protected CacheControl |
getCacheControl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
Returns the CacheControl annotation specified for the
given request, response and handler. |
boolean |
preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
|
void |
setUseExpiresHeader(boolean useExpiresHeader)
True to set an expires header when a CacheControl annotation is present
on a handler; false otherwise. |
| Methods inherited from class org.springframework.web.servlet.handler.HandlerInterceptorAdapter |
|---|
afterCompletion, postHandle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor |
|---|
afterCompletion, postHandle |
| Constructor Detail |
|---|
public CacheControlHandlerInterceptor()
| Method Detail |
|---|
protected final void assignCacheControlHeader(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
CacheControl header to the given response.
request - the HttpServletRequestresponse - the HttpServletResponsehandler - the handler for the given requestprotected final String createCacheControlHeader(CacheControl cacheControl)
CacheControl
annotation.
cacheControl - the CacheControl annotation from which to
create the returned cache control header value
protected final long createExpiresHeader(CacheControl cacheControl)
CacheControl annotation.
cacheControl - the CacheControl annotation from which to
create the returned expires header value
protected final CacheControl getCacheControl(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
CacheControl annotation specified for the
given request, response and handler.
request - the current HttpServletRequestresponse - the current HttpServletResponsehandler - the current request handler
CacheControl annotation specified by
the given handler if present; null otherwise
public final boolean preHandle(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler)
throws Exception
preHandle in interface org.springframework.web.servlet.HandlerInterceptorpreHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterExceptionpublic final void setUseExpiresHeader(boolean useExpiresHeader)
CacheControl annotation is present
on a handler; false otherwise. Defaults to true.
useExpiresHeader - true to set an expires header when a
CacheControl annotation is present on a handler; false otherwise
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||