public class FormUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
FormUtils.MapStringFormField |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_FORMDATA_CONTAINER |
static String |
DEFAULT_FORMDATA_TYPE |
static String |
DEFAULT_STORED_FORMS_LOCATION |
static String |
DEFAULT_UUID_NAME |
static String |
FORM_DATA_FLAT_STORAGE_CONFIG_PROP |
static String |
HST_CREATIONTIME |
static String |
HST_FORM_DATA_NODE |
static String |
HST_FORM_FIELD_DATA |
static String |
HST_FORM_FIELD_MESSAGES |
static String |
HST_FORM_FIELD_NAME |
static String |
HST_FORM_ID |
static String |
HST_PREDECESSOR |
static String |
HST_SEALED |
static String |
MIXIN_FORM_DATA_PAYLOAD |
static String |
PATH_SEPARATOR |
static String |
PROPERTY_FORM_DATA_PAYLOAD |
Constructor and Description |
---|
FormUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.jcr.Node |
createFormDataNode(javax.jcr.Node formDataBaseNode,
String path) |
static FormMap |
getFormMap(javax.servlet.http.HttpServletRequest request)
Returns a populated FormaMap for some form data node if that node can be found with the u_u_i_d parameter
on the
request . |
static javax.jcr.Session |
getWritableSession() |
static void |
persistFormMap(HstRequest request,
HstResponse response,
FormMap formMap,
StoreFormResult storeFormResult) |
static void |
persistFormMap(String formDataNodePath,
String formId,
HstRequest request,
HstResponse response,
FormMap formMap,
StoreFormResult storeFormResult,
boolean includeRenderParameter)
Facility to temporarily store submitted form data which needs to be accessed in the rendering phase again.
|
static void |
populate(HstRequest request,
FormMap formMap)
This method tries to repopulate an earlier posted form that was stored in the repository.
|
static void |
populate(javax.servlet.http.HttpServletRequest request,
FormMap formMap)
This method tries to repopulate an earlier posted form that was stored in the repository.
|
static void |
validateId(String uuid)
Validates an uuid.
|
public static final String PATH_SEPARATOR
public static final String FORM_DATA_FLAT_STORAGE_CONFIG_PROP
public static final String DEFAULT_UUID_NAME
public static final String DEFAULT_STORED_FORMS_LOCATION
public static final String DEFAULT_FORMDATA_CONTAINER
public static final String DEFAULT_FORMDATA_TYPE
public static final String HST_FORM_ID
public static final String HST_CREATIONTIME
public static final String HST_PREDECESSOR
public static final String HST_FORM_DATA_NODE
public static final String HST_FORM_FIELD_DATA
public static final String HST_FORM_FIELD_MESSAGES
public static final String HST_FORM_FIELD_NAME
public static final String MIXIN_FORM_DATA_PAYLOAD
public static final String PROPERTY_FORM_DATA_PAYLOAD
public static final String HST_SEALED
public static FormMap getFormMap(javax.servlet.http.HttpServletRequest request)
request
. If no such form data node can be found, an empty FormMap
will be returnedrequest
- the HttpServletRequest
FormMap
for the formdata node belonging to the UUID from request parameter u_u_i_d
If there is no formdata for the UUID or no u_u_i_d parameter, just an empty FormMap
object will be returned#populate(javax.servlet.http.HttpServletRequest, FormMap)}
public static void populate(javax.servlet.http.HttpServletRequest request, FormMap formMap)
Only when there is a request parameter containing the correct uuid, it can be re-populated.
request
- the HttpServletRequest
formMap
- a not yet populated FormMap object (just new FormMap())public static void populate(HstRequest request, FormMap formMap)
request
- the current hstRequestformMap
- the formMap that will be populatedrather use {@link #populate(javax.servlet.http.HttpServletRequest, FormMap)} instead
of this method
public static void persistFormMap(HstRequest request, HstResponse response, FormMap formMap, StoreFormResult storeFormResult) throws HstComponentException
HstComponentException
#persistFormMap(String, String, HstRequest, HstResponse, FormMap, StoreFormResult, boolean)} with
{@code formDataNodePath} = null, {@code formId} = null annd {@code includeRenderParameter} = true
public static void persistFormMap(String formDataNodePath, String formId, HstRequest request, HstResponse response, FormMap formMap, StoreFormResult storeFormResult, boolean includeRenderParameter) throws HstComponentException
formDataNodePath
- form data node path relative to the root form data node FormUtils#DEFAULT_STORED_FORMS_LOCATION
to store the result in. If null
, a random location will be pickedformId
- optional value for a formId. If null
, no formId will be storedrequest
- the requestresponse
- the responseformMap
- the form names + values to temporarily storestoreFormResult
- an object to store some result of the data persisting, for example the uuid of the created nodeincludeRenderParameter
- if true
, HstResponse.setRenderParameter(String, String)
will be invoked with
param DEFAULT_UUID_NAME
and with value the identifier of the stored form mapHstComponentException
- when the storing of the formdata failspublic static javax.jcr.Node createFormDataNode(javax.jcr.Node formDataBaseNode, String path) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void validateId(String uuid) throws IllegalArgumentException
uuid
- uuid to validateIllegalArgumentException
- thrown on invalid uuidpublic static javax.jcr.Session getWritableSession() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.