|
|
|
@ -7,6 +7,7 @@ import javax.servlet.FilterChain;
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
|
|
import javax.servlet.ServletRequest;
|
|
|
|
|
import javax.servlet.ServletResponse;
|
|
|
|
|
import javax.servlet.http.Cookie;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.servlet.http.HttpServletResponseWrapper;
|
|
|
|
|
|
|
|
|
@ -28,6 +29,19 @@ public class ResponseHeaderFilter implements Filter {
|
|
|
|
|
|
|
|
|
|
chain.doFilter(request, new HttpServletResponseWrapper((HttpServletResponse) response) {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addCookie(Cookie cookie) {
|
|
|
|
|
|
|
|
|
|
if(cookie.getValue().equals("") && cookie.getMaxAge() == 0) {
|
|
|
|
|
cookie.setValue("null");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cookie.setHttpOnly(true);
|
|
|
|
|
|
|
|
|
|
super.addCookie(cookie);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setContentType(String type) {
|
|
|
|
|
if(type.equals("text/css")
|
|
|
|
|