Package com.day.cq.wcm.foundation.forms
Class FormsHandlingServletHelper
- java.lang.Object
-
- com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper
-
public class FormsHandlingServletHelper extends java.lang.Object
A helper for form handling. Note: this helper class needs to be publicly available as it is being used in the Core Component code base (in com.adobe.cq.wcm.core.components.internal.servlets.CoreFormHandlingServlet)
-
-
Constructor Summary
Constructors Constructor Description FormsHandlingServletHelper(java.lang.String[] parameterNameWhitelist, SaferSlingPostValidator validator, java.util.Set<java.lang.String> formResourceTypes, boolean allowExpressions, FormStructureHelperFactory formStructureHelperFactory)
A helper class for handling form POSTS.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
Helper method which validates the submitted form and then forwards request to appropriate action handler.void
handleFilter(ServletRequest request, ServletResponse response, FilterChain chain, java.lang.String extensionToAdd, java.lang.String selectorToAdd)
Checks if resource in request if form type.
-
-
-
Constructor Detail
-
FormsHandlingServletHelper
public FormsHandlingServletHelper(java.lang.String[] parameterNameWhitelist, SaferSlingPostValidator validator, java.util.Set<java.lang.String> formResourceTypes, boolean allowExpressions, FormStructureHelperFactory formStructureHelperFactory)
A helper class for handling form POSTS.- Parameters:
parameterNameWhitelist
- Parameter names that will pass request validation. A validation error will occur if any posted parameters are not in the whitelist and not defined on the form.validator
-SaferSlingPostValidator
formResourceTypes
- sling resource types of forms which this class can handleallowExpressions
- True to evaluate expressions on form submissions. For details seeFormsHelper.allowExpressions(SlingHttpServletRequest)
formStructureHelperFactory
- Form structure helper
-
-
Method Detail
-
doPost
public void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws java.io.IOException, ServletException
Helper method which validates the submitted form and then forwards request to appropriate action handler.- Parameters:
request
-SlingHttpServletRequest
response
-SlingHttpServletResponse
- Throws:
java.io.IOException
- if post caused an errorServletException
- if post caused an error
-
handleFilter
public void handleFilter(ServletRequest request, ServletResponse response, FilterChain chain, java.lang.String extensionToAdd, java.lang.String selectorToAdd) throws java.io.IOException, ServletException
Checks if resource in request if form type. If yes, then adds passed selector and extension to the request.- Parameters:
request
-ServletRequest
response
-ServletResponse
chain
-FilterChain
extensionToAdd
- extension to be added to request eg. "html"selectorToAdd
- selector to be added to request.- Throws:
java.io.IOException
-IOException
ServletException
-ServletException
-
-