@Override public ContainerRequest filter(final ContainerRequest request) { if (this.forceSSL && (!request.isSecure())) { throw new PermanentRedirectException( UriBuilder.fromUri(request.getRequestUri()).scheme("https").build()); } return request; }
@Override public ContainerResponse filter( final ContainerRequest request, final ContainerResponse response) { if (request.isSecure()) { final String value = String.format("max-age=%s; includeSubDomains", EXPIRY); response.getHttpHeaders().add("Strict-Transport-Security", value); } return response; }