public class HttpHeaderSecurityFilter extends FilterBase
sm
Constructor and Description |
---|
HttpHeaderSecurityFilter() |
Modifier and Type | Method and Description |
---|---|
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
The
doFilter method of the Filter is called by the container
each time a request/response pair is passed through the chain due to a
client request for a resource at the end of the chain. |
java.lang.String |
getAntiClickJackingOption() |
java.lang.String |
getAntiClickJackingUri() |
int |
getHstsMaxAgeSeconds() |
protected Log |
getLogger() |
void |
init(FilterConfig filterConfig)
Iterates over the configuration parameters and either logs a warning,
or throws an exception for any parameter that does not have a matching
setter in this filter.
|
boolean |
isAntiClickJackingEnabled() |
boolean |
isBlockContentTypeSniffingEnabled() |
protected boolean |
isConfigProblemFatal()
Determines if an exception when calling a setter or an unknown
configuration attribute triggers the failure of the this filter which in
turn will prevent the web application from starting.
|
boolean |
isHstsEnabled() |
boolean |
isHstsIncludeSubDomains() |
boolean |
isHstsPreload() |
boolean |
isXssProtectionEnabled() |
void |
setAntiClickJackingEnabled(boolean antiClickJackingEnabled) |
void |
setAntiClickJackingOption(java.lang.String antiClickJackingOption) |
void |
setAntiClickJackingUri(java.lang.String antiClickJackingUri) |
void |
setBlockContentTypeSniffingEnabled(boolean blockContentTypeSniffingEnabled) |
void |
setHstsEnabled(boolean hstsEnabled) |
void |
setHstsIncludeSubDomains(boolean hstsIncludeSubDomains) |
void |
setHstsMaxAgeSeconds(int hstsMaxAgeSeconds) |
void |
setHstsPreload(boolean hstsPreload) |
void |
setXssProtectionEnabled(boolean xssProtectionEnabled) |
destroy
public void init(FilterConfig filterConfig) throws ServletException
FilterBase
init
in interface Filter
init
in class FilterBase
filterConfig
- The configuration information associated with the
filter instance being initialisedServletException
- if FilterBase.isConfigProblemFatal()
returns
true
and a configured parameter does not
have a matching setterpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, ServletException
javax.servlet.Filter
doFilter
method of the Filter is called by the container
each time a request/response pair is passed through the chain due to a
client request for a resource at the end of the chain. The FilterChain
passed in to this method allows the Filter to pass on the request and
response to the next entity in the chain.
A typical implementation of this method would follow the following
pattern:-
1. Examine the request
2. Optionally wrap the request object with a custom implementation to
filter content or headers for input filtering
3. Optionally wrap the response object with a custom implementation to
filter content or headers for output filtering
4. a) Either invoke the next entity in the chain using
the FilterChain object (chain.doFilter()
),
4. b) or not pass on the request/response pair to the
next entity in the filter chain to block the request processing
5. Directly set headers on the response after invocation of the next
entity in the filter chain.
request
- The request to processresponse
- The response associated with the requestchain
- Provides access to the next filter in the chain for this
filter to pass the request and response to for further
processingjava.io.IOException
- if an I/O error occurs during this filter's
processing of the requestServletException
- if the processing fails for any other reasonprotected Log getLogger()
getLogger
in class FilterBase
protected boolean isConfigProblemFatal()
FilterBase
isConfigProblemFatal
in class FilterBase
true
if a problem should trigger the failure of this
filter, else false
public boolean isHstsEnabled()
public void setHstsEnabled(boolean hstsEnabled)
public int getHstsMaxAgeSeconds()
public void setHstsMaxAgeSeconds(int hstsMaxAgeSeconds)
public boolean isHstsIncludeSubDomains()
public void setHstsIncludeSubDomains(boolean hstsIncludeSubDomains)
public boolean isHstsPreload()
public void setHstsPreload(boolean hstsPreload)
public boolean isAntiClickJackingEnabled()
public void setAntiClickJackingEnabled(boolean antiClickJackingEnabled)
public java.lang.String getAntiClickJackingOption()
public void setAntiClickJackingOption(java.lang.String antiClickJackingOption)
public java.lang.String getAntiClickJackingUri()
public boolean isBlockContentTypeSniffingEnabled()
public void setBlockContentTypeSniffingEnabled(boolean blockContentTypeSniffingEnabled)
public void setAntiClickJackingUri(java.lang.String antiClickJackingUri)
public boolean isXssProtectionEnabled()
public void setXssProtectionEnabled(boolean xssProtectionEnabled)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.