|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.day.cq.wcm.foundation.forms.FormsHelper
public class FormsHelper
Helper class for the forms components.
| Field Summary | |
|---|---|
static String |
REQ_ATTR_CLIENT_VALIDATION
|
static String |
REQ_ATTR_FORMID
|
static String |
REQ_ATTR_FORWARD_PATH
|
static String |
REQ_ATTR_GLOBAL_LOAD_RSRC
|
static String |
REQ_ATTR_IS_INIT
|
static String |
REQ_ATTR_WRITTEN_JAVASCRIPT
|
| Method Summary | |
|---|---|
static org.apache.sling.api.resource.Resource |
checkFormStructure(org.apache.sling.api.resource.Resource rsrc)
Fix the form. |
static String |
decodeValue(String value)
Url decode the value. |
static boolean |
doClientValidation(org.apache.sling.api.SlingHttpServletRequest req)
Are we generating client validation? |
static String |
encodeValue(String value)
Url encode the value. |
static void |
endForm(org.apache.sling.api.SlingHttpServletRequest req)
Signal the end of the form. |
static Iterator<String> |
getContentRequestParameterNames(org.apache.sling.api.SlingHttpServletRequest req)
Return a list of content fields. |
static Iterator<org.apache.sling.api.resource.Resource> |
getFormElements(org.apache.sling.api.resource.Resource formResource)
Return all form elements for this form. |
static String |
getFormId(org.apache.sling.api.SlingHttpServletRequest req)
Return the formid |
static String |
getFormsPreCheckMethodName(org.apache.sling.api.SlingHttpServletRequest req)
Return the name of the check method |
static String |
getForwardPath(org.apache.sling.api.SlingHttpServletRequest req)
Get the forward path for processing the form. |
static org.apache.sling.api.resource.ValueMap |
getGlobalFormValues(org.apache.sling.api.SlingHttpServletRequest req)
Return the form values to load. |
static Map<String,String> |
getOptions(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
Return the options for a form element |
static String |
getParameterName(org.apache.sling.api.resource.Resource rsrc)
Return the parameter name for the field |
static String |
getTitle(org.apache.sling.api.resource.Resource formElement,
String defaultTitle)
Return the title for the field. |
static String |
getValue(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
Return the value for the element. |
static String[] |
getValues(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
Return the values for the element. |
static List<String> |
getValuesAsList(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
Return the values for the element as a list This method |
static boolean |
hasMultiSelection(org.apache.sling.api.resource.Resource formElement)
Is this a field with multi selection? |
static void |
includeResource(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response,
org.apache.sling.api.resource.Resource resource,
String selectorString)
Include the resource with the given selector with method GET |
static boolean |
isRequired(org.apache.sling.api.resource.Resource formElement)
Is this field required? |
static void |
redirectToReferrer(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse res)
Redirect to the referrer. |
static void |
redirectToReferrer(org.apache.sling.api.SlingHttpServletRequest req,
org.apache.sling.api.SlingHttpServletResponse res,
Map<String,String[]> params)
Redirect to the referrer. |
static void |
setFormLoadResource(org.apache.sling.api.SlingHttpServletRequest req,
org.apache.sling.api.resource.Resource rsrc)
Set the load resource for the form. |
static void |
setForwardPath(org.apache.sling.api.SlingHttpServletRequest req,
String path)
Set the forward path for processing the form. |
static void |
startForm(org.apache.sling.api.SlingHttpServletRequest req,
org.apache.sling.api.SlingHttpServletResponse response,
javax.servlet.jsp.JspWriter out)
Signal the start of the form. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String REQ_ATTR_GLOBAL_LOAD_RSRC
public static final String REQ_ATTR_CLIENT_VALIDATION
public static final String REQ_ATTR_FORMID
public static final String REQ_ATTR_WRITTEN_JAVASCRIPT
public static final String REQ_ATTR_FORWARD_PATH
public static final String REQ_ATTR_IS_INIT
| Method Detail |
|---|
public static void startForm(org.apache.sling.api.SlingHttpServletRequest req,
org.apache.sling.api.SlingHttpServletResponse response,
javax.servlet.jsp.JspWriter out)
throws IOException,
javax.servlet.ServletException
req - Request
IOException
javax.servlet.ServletExceptionpublic static void endForm(org.apache.sling.api.SlingHttpServletRequest req)
req - Request
public static void setForwardPath(org.apache.sling.api.SlingHttpServletRequest req,
String path)
req - The current request.path - The forward path.public static String getForwardPath(org.apache.sling.api.SlingHttpServletRequest req)
req - The current request.
public static void setFormLoadResource(org.apache.sling.api.SlingHttpServletRequest req,
org.apache.sling.api.resource.Resource rsrc)
req - The current request.rsrc - The load resourcepublic static String getFormsPreCheckMethodName(org.apache.sling.api.SlingHttpServletRequest req)
req - The current request.
public static void includeResource(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse response,
org.apache.sling.api.resource.Resource resource,
String selectorString)
throws IOException,
javax.servlet.ServletException
request - The current request.response - The current response.resource - The resource to include.selectorString - The selector string to use for inclusion.
IOException
javax.servlet.ServletExceptionpublic static org.apache.sling.api.resource.ValueMap getGlobalFormValues(org.apache.sling.api.SlingHttpServletRequest req)
req - The request
public static boolean doClientValidation(org.apache.sling.api.SlingHttpServletRequest req)
req - Request
public static String getFormId(org.apache.sling.api.SlingHttpServletRequest req)
req - Request
public static String getParameterName(org.apache.sling.api.resource.Resource rsrc)
rsrc -
public static Iterator<org.apache.sling.api.resource.Resource> getFormElements(org.apache.sling.api.resource.Resource formResource)
formResource - The form resource-
public static Iterator<String> getContentRequestParameterNames(org.apache.sling.api.SlingHttpServletRequest req)
public static String getValue(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
getValues(SlingHttpServletRequest, Resource) and returns
if available the first value from the array.
request - The current request.elementResource - The element resource.
public static String[] getValues(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
request - The current request.elementResource - The element resource.
public static List<String> getValuesAsList(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
request - The current request.elementResource - The element resource.
public static Map<String,String> getOptions(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource elementResource)
request - elementResource -
public static boolean isRequired(org.apache.sling.api.resource.Resource formElement)
formElement - The form element.
public static String getTitle(org.apache.sling.api.resource.Resource formElement,
String defaultTitle)
formElement - The form element.defaultTitle - The default title.
public static boolean hasMultiSelection(org.apache.sling.api.resource.Resource formElement)
formElement - The form element
public static void redirectToReferrer(org.apache.sling.api.SlingHttpServletRequest req,
org.apache.sling.api.SlingHttpServletResponse res,
Map<String,String[]> params)
throws IOException
req - The current requestres - The current response
IOException
public static void redirectToReferrer(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.SlingHttpServletResponse res)
throws IOException
request - The current requestres - The current response
IOExceptionpublic static org.apache.sling.api.resource.Resource checkFormStructure(org.apache.sling.api.resource.Resource rsrc)
public static String encodeValue(String value)
value - The value
public static String decodeValue(String value)
value - The value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||