public final class CspInterceptor extends AbstractInterceptor
CspSettings
to add appropriate Content Security Policy header
to the response. These headers determine what the browser will consider a policy violation and the browser's behavior
when a violation occurs. A detailed explanation of CSP can be found here.Constructor and Description |
---|
CspInterceptor() |
Modifier and Type | Method and Description |
---|---|
String |
intercept(ActionInvocation invocation)
Override to handle interception
|
void |
setEnforcingMode(boolean enforcingMode)
Enables enforcing mode, by default all exceptions are only reported
|
void |
setPrependServletContext(boolean prependServletContext)
Sets whether to prepend the servlet context path to the
reportUri . |
void |
setReportUri(String reportUri) |
destroy, init, setDisabled, shouldIntercept
public String intercept(ActionInvocation invocation) throws Exception
AbstractInterceptor
intercept
in interface Interceptor
intercept
in class AbstractInterceptor
invocation
- the action invocationActionInvocation.invoke()
, or from the interceptor itself.Exception
- any system-level error, as defined in Action.execute()
.public void setReportUri(String reportUri)
public void setEnforcingMode(boolean enforcingMode)
enforcingMode
- true
to enable enforcing mode, false
to keep reporting mode.public void setPrependServletContext(boolean prependServletContext)
reportUri
.prependServletContext
- true
to prepend the location with the servlet context path,
false
otherwise.Copyright © 2000–2024 Apache Software Foundation. All rights reserved.