package nl.nn.adapterframework.http;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.Date;

public class CacheControlFilter implements Filter {

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

        HttpServletResponse resp = (HttpServletResponse) response;
        //resp.setHeader("Expires", "Tue, 03 Jul 2001 06:00:00 GMT");
        resp.setDateHeader("Last-Modified", new Date().getTime());
        //resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0"); //Disable caching all together...
        resp.setHeader("Cache-Control", "no-cache, must-revalidate, max-age=60, post-check=0, pre-check=0");
        resp.setHeader("Pragma", "no-cache");
        chain.doFilter(request, response);
    }

	public void init(FilterConfig filterConfig) throws ServletException {
		// TODO Auto-generated method stub
		
	}

	public void destroy() {
		// TODO Auto-generated method stub
		
	}

}
@@ -1,64 +1,829 @@
-package nl.nn.adapterframework.http;%0A%0Aimport javax.servlet.*
+/*%0ACopyright 2016-2018 Integration Partners B.V.%0A%0ALicensed under the Apache License, Version 2.0 (the %22License%22);%0Ayou may not use this file except in compliance with the License.%0AYou may obtain a copy of the License at%0A%0A    http://www.apache.org/licenses/LICENSE-2.0%0A%0AUnless required by applicable law or agreed to in writing, software%0Adistributed under the License is distributed on an %22AS IS%22 BASIS,%0AWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0ASee the License for the specific language governing permissions and%0Alimitations under the License.%0A*/%0Apackage nl.nn.adapterframework.http;%0A%0Aimport javax.servlet.Filter;%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.FilterConfig;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletResponse
 ;%0Aim
@@ -914,16 +914,94 @@
 ponse;%0A%0A
+import nl.nn.adapterframework.util.LogUtil;%0A%0Aimport org.apache.log4j.Logger;%0A%0A
 import j
@@ -1097,20 +1097,182 @@
 lter %7B%0A%0A
-    
+%09private Logger log = LogUtil.getLogger(this);%0A%0A%09public void init(FilterConfig filterConfig) throws ServletException %7B%0A%09%09log.debug(%22initializing CacheControl%22);%0A%09%7D%0A%0A%09
 public v
@@ -1393,24 +1393,18 @@
 tion %7B%0A%0A
-        
+%09%09
 HttpServ
@@ -1454,24 +1454,75 @@
 sponse;%0A
-        
+%09%09HttpServletRequest req = (HttpServletRequest) request;%0A%09%09
 //resp.s
@@ -1571,32 +1571,26 @@
 0:00 GMT%22);%0A
-        
+%09%09
 resp.setDate
@@ -1640,18 +1640,10 @@
 ));%0A
-        //
+%09%09
 resp
@@ -1751,206 +1751,117 @@
 0%22);
- //Disable caching all together...%0A        resp.setHeader(%22Cache-Control%22, %22no-cache, must-revalidate, max-age=60, post-check=0, pre-check=0%22);%0A        resp.setHeader(%22Pragma%22, %22no-cache%22);%0A        
+%0A%09%09resp.setHeader(%22Pragma%22, %22no-cache%22);%0A%09%09log.trace(%22disabling cache for uri %5B%22+req.getRequestURI()+%22%5D%22);%0A%09%09
 chai
@@ -1891,20 +1891,17 @@
 ponse);%0A
-    
+%09
 %7D%0A%0A%09publ
@@ -1912,176 +1912,60 @@
 oid 
-init(FilterConfig filterConfig) throws ServletException %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09%0A%09%7D%0A%0A%09public void destroy() %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09
+destroy() %7B%0A%09%09log.debug(%22destroying CacheControl%22);
 %0A%09%7D%0A
-%0A
 %7D

Add copyright and logging