Package org.apache.struts2.action
Class CspReportAction
java.lang.Object
org.apache.struts2.ActionSupport
org.apache.struts2.action.CspReportAction
- All Implemented Interfaces:
- Serializable,- Action,- ServletRequestAware,- ServletResponseAware,- ValidationAware,- LocaleProvider,- TextProvider,- Validateable
- Direct Known Subclasses:
- DefaultCspReportAction
public abstract class CspReportAction
extends ActionSupport
implements ServletRequestAware, ServletResponseAware
An abstract Action that can be extended to process the incoming CSP violation reports. Performs
 necessary checks to extract the JSON string of the CSP report and make sure it's a valid report.
 Always returns a 204 response.
 Override the 
processReport(String jsonCspReport) method to customize how the action processes
 the CSP report. See DefaultCspReportAction for the default implementation.
 Add the action to the endpoint that is the reportUri in the CspInterceptor
 to collect the reports.
 
     <package name="csp-reports" namespace="/" extends="struts-default">
         <action name="csp-reports" class="org.apache.struts2.action.DefaultCspReportAction">
             <result type="httpheader">
                 <param name="status">204</param>
             </result>
         </action>
     </package>
 - See Also:
- 
Field SummaryFields inherited from class org.apache.struts2.ActionSupportcontainer
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionjakarta.servlet.http.HttpServletRequestvoidsetServletRequest(jakarta.servlet.http.HttpServletRequest request) voidwithServletRequest(jakarta.servlet.http.HttpServletRequest request) Applies the HTTP request object in implementing classes.voidwithServletResponse(jakarta.servlet.http.HttpServletResponse response) Applies the HTTP response object in implementing classes.Methods inherited from class org.apache.struts2.ActionSupportaddActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, execute, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocale, getLocaleProvider, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, toLocale, validate
- 
Constructor Details- 
CspReportActionpublic CspReportAction()
 
- 
- 
Method Details- 
withServletRequestpublic void withServletRequest(jakarta.servlet.http.HttpServletRequest request) Description copied from interface:ServletRequestAwareApplies the HTTP request object in implementing classes.- Specified by:
- withServletRequestin interface- ServletRequestAware
- Parameters:
- request- the HTTP request.
 
- 
withServletResponsepublic void withServletResponse(jakarta.servlet.http.HttpServletResponse response) Description copied from interface:ServletResponseAwareApplies the HTTP response object in implementing classes.- Specified by:
- withServletResponsein interface- ServletResponseAware
- Parameters:
- response- the HTTP response.
 
- 
setServletRequestpublic void setServletRequest(jakarta.servlet.http.HttpServletRequest request) 
- 
getServletRequestpublic jakarta.servlet.http.HttpServletRequest getServletRequest()
 
-