mirror of
https://github.com/sismics/docs.git
synced 2024-11-10 16:53:23 +01:00
Closes #146: no cache
This commit is contained in:
parent
244ddc7ce2
commit
f57cf46313
@ -12,6 +12,7 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
|
||||
import com.lowagie.text.FontFactory;
|
||||
import org.apache.log4j.Level;
|
||||
@ -97,6 +98,7 @@ public class RequestContextFilter implements Filter {
|
||||
tx.begin();
|
||||
|
||||
try {
|
||||
addCacheHeaders(response);
|
||||
filterChain.doFilter(request, response);
|
||||
} catch (Exception e) {
|
||||
ThreadLocalContext.cleanup();
|
||||
@ -151,4 +153,15 @@ public class RequestContextFilter implements Filter {
|
||||
|
||||
ThreadLocalContext.cleanup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add no-cache header.
|
||||
*
|
||||
* @param response Response
|
||||
*/
|
||||
private void addCacheHeaders(ServletResponse response) {
|
||||
HttpServletResponse r = (HttpServletResponse) response;
|
||||
r.addHeader(HttpHeaders.CACHE_CONTROL, "no-cache");
|
||||
r.addHeader(HttpHeaders.EXPIRES, "0");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user