forked from github/dataease
refactor(系统设置): 修改http缓存逻辑
This commit is contained in:
parent
3a4daa48b0
commit
33edd9b3be
@ -13,7 +13,7 @@ import java.io.IOException;
|
|||||||
@Component
|
@Component
|
||||||
public class HtmlResourceFilter implements Filter, Ordered {
|
public class HtmlResourceFilter implements Filter, Ordered {
|
||||||
|
|
||||||
@Value("${dataease.http.cache:true}")
|
@Value("${dataease.http.cache:false}")
|
||||||
private Boolean httpCache;
|
private Boolean httpCache;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -28,7 +28,7 @@ public class HtmlResourceFilter implements Filter, Ordered {
|
|||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||||
HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
|
HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
|
||||||
if(httpCache!=null && httpCache){
|
if(httpCache == null || !httpCache){
|
||||||
// 禁用缓存
|
// 禁用缓存
|
||||||
httpResponse.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache");
|
httpResponse.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache");
|
||||||
httpResponse.setHeader("Cache", "no-cache");
|
httpResponse.setHeader("Cache", "no-cache");
|
||||||
|
Loading…
Reference in New Issue
Block a user