@Test public void testDisabledByDefault() { sslFilter.postHandle(request, response); assertNull(response.getHeader(HTTP_HEADER)); }
@Override protected void postHandle(ServletRequest request, ServletResponse response) { if (hsts.isEnabled()) { StringBuilder directives = new StringBuilder(64) .append("max-age=").append(hsts.getMaxAge()); if (hsts.isIncludeSubDomains()) { directives.append("; includeSubDomains"); } HttpServletResponse resp = (HttpServletResponse) response; resp.addHeader(HSTS.HTTP_HEADER, directives.toString()); } }
SslFilter extends PortFilter { @Override protected void postHandle(ServletRequest request, ServletResponse response) { if (hsts.isEnabled()) { StringBuilder directives = new StringBuilder(64) .append("max-age=").append(hsts.getMaxAge()); if (hsts.isIncludeSubDomains()) { directives.append("; includeSubDomains"); } HttpServletResponse resp = (HttpServletResponse) response; resp.addHeader(HSTS.HTTP_HEADER, directives.toString()); } } }
SslFilter extends PortFilter { @Override protected void postHandle(ServletRequest request, ServletResponse response) { if (hsts.isEnabled()) { StringBuilder directives = new StringBuilder(64) .append("max-age=").append(hsts.getMaxAge()); if (hsts.isIncludeSubDomains()) { directives.append("; includeSubDomains"); } HttpServletResponse resp = (HttpServletResponse) response; resp.addHeader(HSTS.HTTP_HEADER, directives.toString()); } } SslFilter(); }
SslFilter extends PortFilter { @Override protected void postHandle(ServletRequest request, ServletResponse response) { if (hsts.isEnabled()) { StringBuilder directives = new StringBuilder(64) .append("max-age=").append(hsts.getMaxAge()); if (hsts.isIncludeSubDomains()) { directives.append("; includeSubDomains"); } HttpServletResponse resp = (HttpServletResponse) response; resp.addHeader(HSTS.HTTP_HEADER, directives.toString()); } } SslFilter(); HSTS getHsts(); void setHsts(HSTS hsts); }
SslFilter extends PortFilter { @Override protected void postHandle(ServletRequest request, ServletResponse response) { if (hsts.isEnabled()) { StringBuilder directives = new StringBuilder(64) .append("max-age=").append(hsts.getMaxAge()); if (hsts.isIncludeSubDomains()) { directives.append("; includeSubDomains"); } HttpServletResponse resp = (HttpServletResponse) response; resp.addHeader(HSTS.HTTP_HEADER, directives.toString()); } } SslFilter(); HSTS getHsts(); void setHsts(HSTS hsts); static final int DEFAULT_HTTPS_PORT; static final String HTTPS_SCHEME; }