Interface FormHelper
-
- All Known Subinterfaces:
ForwardAsGetFormHelper,PostRedirectGetFormHelper,PostRedirectGetWithCookiesFormHelper
@ProviderType public interface FormHelper
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_FORM_SELECTORstatic StringEXTENSIONstatic StringFORM_NAME_INPUTstatic StringFORM_RESOURCE_INPUTstatic intSERVICE_RANKING_BASEstatic intSERVICE_RANKING_FORWARD_AS_GETstatic intSERVICE_RANKING_POST_REDIRECT_GETstatic intSERVICE_RANKING_POST_REDIRECT_WITH_COOKIES_GET
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetAction(com.day.cq.wcm.api.Page page)Builds the form's action URI based on the provided page's pathStringgetAction(com.day.cq.wcm.api.Page page, String formSelector)Builds the form's action URI based on the provided page's pathStringgetAction(String path)Builds the form's action URI based on the provided pathStringgetAction(String path, String formSelector)Builds the form's action URI based on the provided pathStringgetAction(org.apache.sling.api.resource.Resource resource)Builds the form's action URI based on the provided resource's pathStringgetAction(org.apache.sling.api.resource.Resource resource, String formSelector)Builds the form's action URI based on the provided resource's pathFormgetForm(String formName, org.apache.sling.api.SlingHttpServletRequest request)Gets the From from either the POST Requests parameters or the GET request's (synthetic) attributes.FormgetForm(String formName, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Gets the From from either the POST Requests parameters or the GET request's (synthetic) attributes.StringgetFormInputsHTML(Form form, String... keys)Returns a series of hidden fields used to persist multi-page form data between forms.StringgetFormSelector(org.apache.sling.api.SlingHttpServletRequest slingRequest)Gets the Form Selector for the form POST request.voidrenderForm(Form form, com.day.cq.wcm.api.Page page, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.voidrenderForm(Form form, String path, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.voidrenderForm(Form form, org.apache.sling.api.resource.Resource resource, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.voidrenderOtherForm(Form form, com.day.cq.wcm.api.Page page, String selectors, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.voidrenderOtherForm(Form form, String path, String selectors, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.voidrenderOtherForm(Form form, org.apache.sling.api.resource.Resource resource, String selectors, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.
-
-
-
Field Detail
-
EXTENSION
static final String EXTENSION
- See Also:
- Constant Field Values
-
DEFAULT_FORM_SELECTOR
static final String DEFAULT_FORM_SELECTOR
- See Also:
- Constant Field Values
-
FORM_NAME_INPUT
static final String FORM_NAME_INPUT
- See Also:
- Constant Field Values
-
FORM_RESOURCE_INPUT
static final String FORM_RESOURCE_INPUT
- See Also:
- Constant Field Values
-
SERVICE_RANKING_FORWARD_AS_GET
static final int SERVICE_RANKING_FORWARD_AS_GET
- See Also:
- Constant Field Values
-
SERVICE_RANKING_POST_REDIRECT_GET
static final int SERVICE_RANKING_POST_REDIRECT_GET
- See Also:
- Constant Field Values
-
SERVICE_RANKING_POST_REDIRECT_WITH_COOKIES_GET
static final int SERVICE_RANKING_POST_REDIRECT_WITH_COOKIES_GET
- See Also:
- Constant Field Values
-
SERVICE_RANKING_BASE
static final int SERVICE_RANKING_BASE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getForm
Form getForm(String formName, org.apache.sling.api.SlingHttpServletRequest request)
Gets the From from either the POST Requests parameters or the GET request's (synthetic) attributes.- Parameters:
formName-request-- Returns:
-
getForm
Form getForm(String formName, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response)
Gets the From from either the POST Requests parameters or the GET request's (synthetic) attributes.- Parameters:
formName-request-response-- Returns:
-
getFormInputsHTML
String getFormInputsHTML(Form form, String... keys)
Returns a series of hidden fields used to persist multi-page form data between forms.- Parameters:
form-keys-- Returns:
- Throws:
IOException
-
getFormSelector
String getFormSelector(org.apache.sling.api.SlingHttpServletRequest slingRequest)
Gets the Form Selector for the form POST request.- Parameters:
slingRequest-- Returns:
-
getAction
String getAction(org.apache.sling.api.resource.Resource resource)
Builds the form's action URI based on the provided resource's pathAppends ".post.html" to the resource's path.
- Parameters:
resource-- Returns:
-
getAction
String getAction(org.apache.sling.api.resource.Resource resource, String formSelector)
Builds the form's action URI based on the provided resource's pathAppends ".html/
" to the resource's path. - Parameters:
resource-formSelector-- Returns:
-
getAction
String getAction(com.day.cq.wcm.api.Page page)
Builds the form's action URI based on the provided page's pathAppends ".html/
/ " to the page's path. - Parameters:
page-- Returns:
-
getAction
String getAction(com.day.cq.wcm.api.Page page, String formSelector)
Builds the form's action URI based on the provided page's pathAppends ".html/
/ " to the page's path. - Parameters:
page-formSelector-- Returns:
-
getAction
String getAction(String path)
Builds the form's action URI based on the provided pathAppends ".html/
" to the path. - Parameters:
path-- Returns:
-
getAction
String getAction(String path, String formSelector)
Builds the form's action URI based on the provided pathAppends ".html/
/ " to the path. - Parameters:
path-formSelector-- Returns:
-
renderForm
void renderForm(Form form, String path, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException, javax.servlet.ServletException
Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.- Wraps implementing FormHelper's `render(..)` method (sendRedirect or forwardAsGet) in the implementing FormHelper
- Parameters:
form-path-request-response-- Throws:
IOExceptionjavax.servlet.ServletExceptionJSONException
-
renderForm
void renderForm(Form form, com.day.cq.wcm.api.Page page, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException, javax.servlet.ServletException
Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.- Wraps implementing FormHelper's `render(..)` method (sendRedirect or forwardAsGet) in the implementing FormHelper
- Parameters:
form-page-request-response-- Throws:
IOExceptionjavax.servlet.ServletExceptionJSONException
-
renderForm
void renderForm(Form form, org.apache.sling.api.resource.Resource resource, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException, javax.servlet.ServletException
Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.- Wraps implementing `.renderForm(..)` method (sendRedirect or forwardAsGet) in the implementing FormHelper
- Parameters:
form-resource-request-response-- Throws:
IOExceptionjavax.servlet.ServletExceptionJSONException
-
renderOtherForm
void renderOtherForm(Form form, String path, String selectors, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException, javax.servlet.ServletException
Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.- Wraps implementing FormHelper's `render(..)` method (sendRedirect or forwardAsGet) in the implementing FormHelper
- Parameters:
form-path-request-response-- Throws:
IOExceptionjavax.servlet.ServletExceptionJSONException
-
renderOtherForm
void renderOtherForm(Form form, com.day.cq.wcm.api.Page page, String selectors, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException, javax.servlet.ServletException
Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.- Wraps implementing FormHelper's `render(..)` method (sendRedirect or forwardAsGet) in the implementing FormHelper
- Parameters:
form-page-request-response-- Throws:
IOExceptionjavax.servlet.ServletExceptionJSONException
-
renderOtherForm
void renderOtherForm(Form form, org.apache.sling.api.resource.Resource resource, String selectors, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) throws IOException, javax.servlet.ServletException
Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.- Wraps implementing FormHelper's `render(..)` method (sendRedirect or forwardAsGet) in the implementing FormHelper
- Parameters:
form-resource-request-response-- Throws:
IOExceptionjavax.servlet.ServletException
-
-