Interface FormHelper

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String getAction​(com.day.cq.wcm.api.Page page)
      Builds the form's action URI based on the provided page's path
      String getAction​(com.day.cq.wcm.api.Page page, String formSelector)
      Builds the form's action URI based on the provided page's path
      String getAction​(String path)
      Builds the form's action URI based on the provided path
      String getAction​(String path, String formSelector)
      Builds the form's action URI based on the provided path
      String getAction​(org.apache.sling.api.resource.Resource resource)
      Builds the form's action URI based on the provided resource's path
      String getAction​(org.apache.sling.api.resource.Resource resource, String formSelector)
      Builds the form's action URI based on the provided resource's path
      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.
      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.
      String getFormInputsHTML​(Form form, String... keys)
      Returns a series of hidden fields used to persist multi-page form data between forms.
      String getFormSelector​(org.apache.sling.api.SlingHttpServletRequest slingRequest)
      Gets the Form Selector for the form POST request.
      void renderForm​(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.
      void renderForm​(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.
      void renderForm​(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.
      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)
      Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.
      void renderOtherForm​(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.
      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)
      Wrapped method to create a interface from FormHelper to normalize APIs that are commonly used.
    • 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 path

        Appends ".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 path

        Appends ".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 path

        Appends ".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 path

        Appends ".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 path

        Appends ".html/" to the path.

        Parameters:
        path -
        Returns:
      • getAction

        String getAction​(String path,
                         String formSelector)
        Builds the form's action URI based on the provided path

        Appends ".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:
        IOException
        javax.servlet.ServletException
        JSONException
      • 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:
        IOException
        javax.servlet.ServletException
        JSONException
      • 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:
        IOException
        javax.servlet.ServletException
        JSONException
      • 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:
        IOException
        javax.servlet.ServletException
        JSONException
      • 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:
        IOException
        javax.servlet.ServletException
        JSONException
      • 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:
        IOException
        javax.servlet.ServletException