|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FormFilter
FormFilter supports rendering and validation of form-based input. The filter configuration defines default templates for forms, and controls within forms, applied to page templates. Forms are rendered as variables and controls as their named attributes.
Form and control templates may be grouped into themes defining different layout and other visual properties for the corresponding forms. Default templates are applied when a form theme is not specified.
Variables and attributes may be protected by an access controller. Permissions for a variable are granted using its variable type as a resource. Permissions for an attribute are granted using a concatenation of its variable type and name as a resource.
Templates are defined separately for forms, infos (read-only forms), input controls and output controls (read-only controls). The defined template may, but need to, have a qualifier, which specifies its application context. Components of a qualifier are always separated by a dot.
Absolute template paths point to the root of the template engine. Relative template paths are relative to the path of the current page template. The default form template is specified without a qualifier. A variable specific template is specified by using the variable type as a qualifier.
The default input control template is specified without a qualifier. A type specific input control template is specified by using a class name as a qualifier. Controls for primitive types are qualified with the corresponding class types. A generic control for enumerations is qualified with 'enum'. Array types are qualified separately from component types. A generic control for arrays is qualified with '['. Note that any interfaces or superclasses of the type can be used as qualifiers as well.
An attribute specific input control template is specified by using a concatenation of the class name, variable type and attribute name, or any combination of them, as a qualifier.
Optional info and output templates correspond to form and input templates when resolving templates for requests having only read access to the active page template.
Form themes are specified by prefixing the corresponding qualifier with the name of the theme using a dot as a separator.
Properties may be defined to provide additional parameters for specifying template specific styles, formatting and other control. The naming rules of template qualifiers apply but the last component of the qualifier is the name of the property. Note that the name of the property may not contain dots. The corresponding templates are responsible for applying the defined properties.
In addition, property qualifiers may be prefixed with the resolved template name in dot format without the leading slash/dot to apply more fine grained selection of properties. Note that info and output template names can't be applied as additional property selectors.
Localization of forms is enabled by setting the localized forms property. The localization resource bundles are resolved by ResourceFilter by using the concatenation of the corresponding variable type and attribute name as the qualifier.
If a form theme is given as a request attribute or parameter, it will override any default templates.
| Field Summary | |
|---|---|
static String |
FORM_ID_NAME
The recommended form id field name. |
static String |
FORM_INDEX_NAME
The recommended form index field name. |
| Method Summary | |
|---|---|
void |
clearControlAttributes()
Clears all control attributes. |
void |
clearFormProperties()
Clears all form properties. |
void |
clearFormTemplates()
Clears all form templates. |
void |
clearInfoTemplates()
Clears all info templates. |
void |
clearInputTemplates()
Clears all input templates. |
void |
clearOutputTemplates()
Clears all output templates. |
void |
clearParameterMap(ServletRequest request,
ServletResponse response,
FilterChain chain)
Clears the parameter map of the specified request. |
void |
clearParameterMap(String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Clears the prefixed parameter map of the specified request. |
Set |
controlAttributeSet()
Returns a read-only set of control attribute qualifiers. |
Variable |
createVariable(String type)
Creates a new variable instance of the specified type. |
Set |
formPropertySet()
Returns a read-only set of form property qualifiers. |
Set |
formQualifierSet()
Returns a read-only set of form template qualifiers. |
String |
getControlAttribute(String qualifier)
Gets the qualified control attribute. |
String |
getCurrentForm(ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the current form of the specified request. |
String |
getDefaultFormName()
Gets the theme of the default form. |
String |
getFormIdName()
Gets the name of the form id field. |
String |
getFormIndexName()
Gets the name of the form index field. |
String |
getFormProperty(String qualifier)
Gets the qualified form property. |
String |
getFormTemplate()
Gets the default form template. |
String |
getFormTemplate(String qualifier)
Gets the qualified form template. |
String |
getInfoTemplate()
Gets the default info template. |
String |
getInfoTemplate(String qualifier)
Gets the qualified info template. |
String |
getInputTemplate()
Gets the default input template. |
String |
getInputTemplate(String qualifier)
Gets the qualified input template. |
String |
getOutputTemplate()
Gets the default output template. |
String |
getOutputTemplate(String qualifier)
Gets the qualified output template. |
Map |
getParameterMap(ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the parameter map of the specified request. |
Map |
getParameterMap(String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the prefixed parameter map of the specified request. |
Map |
getParameterMap(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the parameter map of the specified variable. |
Map |
getValidationMap(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Gets the validation map of the specified variable. |
ObjectName |
getVariableRegistryName()
Gets the the variable registry of this filter. |
Set |
infoQualifierSet()
Returns a read-only set of info template qualifiers. |
Set |
inputQualifierSet()
Returns a read-only set of input template qualifiers. |
boolean |
isLocalizedForms()
Gets the localized forms flag. |
boolean |
isValidated(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Checks whether the specified variable is validated. |
Set |
outputQualifierSet()
Returns a read-only set of output template qualifiers. |
void |
removeControlAttribute(String qualifier)
Removes the qualified control attribute. |
void |
removeFormProperty(String qualifier)
Removes the qualified form property. |
void |
removeFormTemplate(String qualifier)
Removes the qualified form template. |
void |
removeInfoTemplate(String qualifier)
Removes the qualified info template. |
void |
removeInputTemplate(String qualifier)
Removes the qualified input template. |
void |
removeOutputTemplate(String qualifier)
Removes the qualified output template. |
void |
removeVariable(String prefix,
Variable variable,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Removes the specified form variable from a session. |
void |
render(String name,
Variable variable,
boolean readonly,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Renders a form as Variable. |
void |
render(String name,
Variable variable,
MBeanAttributeInfo attribute,
boolean readonly,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Renders a control as the specified attribute of Variable. |
void |
render(String template,
Variable variable,
MBeanAttributeInfo attribute,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Renders a control as the specified attribute of Variable using a fixed template. |
void |
render(String template,
Variable variable,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Renders a form as Variable using a fixed template. |
String |
resetCurrentForm(ServletRequest request,
ServletResponse response,
FilterChain chain)
Resets the current form of the specified request to the default form. |
String |
resetCurrentForm(String name,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Resets the current form of the specified request to the named form. |
void |
resetParameterMap(ServletRequest request,
ServletResponse response,
FilterChain chain)
Resets the parameter map of the specified request. |
void |
resetParameterMap(String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Resets the prefixed parameter map of the specified request. |
ConcurrentMap |
resolve(String name,
Variable variable,
MBeanAttributeInfo attribute)
Resolves form properties of the specified attribute of Variable. |
Variable |
restoreVariable(String prefix,
String type,
boolean create,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Restores a saved form variable from a session or optionally creates a missing one. |
void |
saveVariable(String prefix,
Variable variable,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Saves the specified form variable to a session. |
void |
setControlAttribute(String qualifier,
String attribute)
Sets the qualified control property. |
void |
setDefaultFormName(String name)
Sets the theme of the default form. |
void |
setFormIdName(String name)
Sets the name of the form id field to post the unique name of the submitted form. |
void |
setFormIndexName(String name)
Sets the name of the form index field to post variable indeces of the submitted form. |
void |
setFormProperty(String qualifier,
String property)
Sets the qualified form property. |
void |
setFormTemplate(String template)
Sets the default form template. |
void |
setFormTemplate(String qualifier,
String template)
Sets the qualified form template. |
void |
setInfoTemplate(String template)
Sets the default info template. |
void |
setInfoTemplate(String qualifier,
String template)
Sets the qualified info template. |
void |
setInputTemplate(String template)
Sets the default input template. |
void |
setInputTemplate(String qualifier,
String template)
Sets the qualified input template. |
void |
setLocalizedForms(boolean flag)
Sets the localized forms flag. |
void |
setOutputTemplate(String template)
Sets the default output template. |
void |
setOutputTemplate(String qualifier,
String template)
Sets the qualified output template. |
void |
setVariableRegistryName(ObjectName registry)
Sets the variable registry of this filter. |
boolean |
updateForm(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Updates the specified variable with request parameters. |
boolean |
validateForm(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
Validates the specified variable with request parameters. |
| Methods inherited from interface org.norther.tammi.spray.filter.SecureFilter |
|---|
checkPermission, checkPermission, checkPermission |
| Methods inherited from interface org.norther.tammi.core.security.AccessController |
|---|
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions |
| Methods inherited from interface javax.servlet.Filter |
|---|
destroy, doFilter, init |
| Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter |
|---|
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey |
| Methods inherited from interface javax.servlet.Filter |
|---|
destroy, doFilter, init |
| Methods inherited from interface org.norther.tammi.core.cache.CacheClient |
|---|
clearCached, expireCached, expireFraction, getCache, isCachingDisabled, removeCache, setCachingDisabled |
| Methods inherited from interface org.norther.tammi.core.base.Refreshable |
|---|
getRefreshed, refresh |
| Field Detail |
|---|
static final String FORM_ID_NAME
static final String FORM_INDEX_NAME
| Method Detail |
|---|
boolean isLocalizedForms()
void setLocalizedForms(boolean flag)
flag - the localized forms flag.String getDefaultFormName()
void setDefaultFormName(String name)
name - the default form.String getFormIdName()
void setFormIdName(String name)
name - the form id attribute name.String getFormIndexName()
void setFormIndexName(String name)
name - the form id attribute name.String getFormTemplate()
void setFormTemplate(String template)
template - the default template.String getInfoTemplate()
void setInfoTemplate(String template)
template - the default template.String getInputTemplate()
void setInputTemplate(String template)
template - the default template.String getOutputTemplate()
void setOutputTemplate(String template)
template - the default template.String getFormTemplate(String qualifier)
qualifier - the qualifier.
void setFormTemplate(String qualifier,
String template)
qualifier - the qualifier.template - the template.void removeFormTemplate(String qualifier)
qualifier - the qualifier.void clearFormTemplates()
Set formQualifierSet()
String getInfoTemplate(String qualifier)
qualifier - the qualifier.
void setInfoTemplate(String qualifier,
String template)
qualifier - the qualifier.template - the template.void removeInfoTemplate(String qualifier)
qualifier - the qualifier.void clearInfoTemplates()
Set infoQualifierSet()
String getInputTemplate(String qualifier)
qualifier - the qualifier.
void setInputTemplate(String qualifier,
String template)
qualifier - the qualifier.template - the template.void removeInputTemplate(String qualifier)
qualifier - the qualifier.void clearInputTemplates()
Set inputQualifierSet()
String getOutputTemplate(String qualifier)
qualifier - the qualifier.
void setOutputTemplate(String qualifier,
String template)
qualifier - the qualifier.template - the template.void removeOutputTemplate(String qualifier)
qualifier - the qualifier.void clearOutputTemplates()
Set outputQualifierSet()
String getFormProperty(String qualifier)
qualifier - the qualifier.
void setFormProperty(String qualifier,
String property)
qualifier - the qualifier.property - the property.void removeFormProperty(String qualifier)
qualifier - the qualifier.void clearFormProperties()
Set formPropertySet()
String getControlAttribute(String qualifier)
qualifier - the qualifier.
void setControlAttribute(String qualifier,
String attribute)
qualifier - the qualifier.attribute - the attribute.void removeControlAttribute(String qualifier)
qualifier - the qualifier.void clearControlAttributes()
Set controlAttributeSet()
ObjectName getVariableRegistryName()
void setVariableRegistryName(ObjectName registry)
registry - the object name of the variable registry or a query.
void clearParameterMap(ServletRequest request,
ServletResponse response,
FilterChain chain)
request - the servlet request.response - the servlet response.chain - the filter chain.
void clearParameterMap(String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
prefix - the parameter name prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
void resetParameterMap(ServletRequest request,
ServletResponse response,
FilterChain chain)
request - the servlet request.response - the servlet response.chain - the filter chain.
void resetParameterMap(String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
prefix - the parameter name prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
Map getParameterMap(ServletRequest request,
ServletResponse response,
FilterChain chain)
request - the servlet request.response - the servlet response.chain - the filter chain.
Map getParameterMap(String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
prefix - the parameter name prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
Map getParameterMap(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
variable - the variable.prefix - an optional prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
boolean isValidated(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
variable - the variable.prefix - an optional prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
Map getValidationMap(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
variable - the variable.prefix - an optional prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
boolean validateForm(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
variable - the variable.prefix - an optional prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
boolean updateForm(Variable variable,
String prefix,
ServletRequest request,
ServletResponse response,
FilterChain chain)
variable - the variable.prefix - an optional prefix.request - the servlet request.response - the servlet response.chain - the filter chain.
Variable createVariable(String type)
throws ConstructionException
type - the type of the variable.
ConstructionException - if construction fails.
Variable restoreVariable(String prefix,
String type,
boolean create,
ServletRequest request,
ServletResponse response,
FilterChain chain)
throws ConstructionException
prefix - an optional prefix.type - the variable type.create - the create option.request - the servlet request.response - the servlet response.chain - the filter chain.
ConstructionException - if construction fails.
void saveVariable(String prefix,
Variable variable,
ServletRequest request,
ServletResponse response,
FilterChain chain)
prefix - an optional prefix.variable - the variable.request - the servlet request.response - the servlet response.chain - the filter chain.
void removeVariable(String prefix,
Variable variable,
ServletRequest request,
ServletResponse response,
FilterChain chain)
prefix - an optional prefix.variable - the variable.request - the servlet request.response - the servlet response.chain - the filter chain.
void render(String name,
Variable variable,
boolean readonly,
ServletRequest request,
ServletResponse response,
FilterChain chain)
throws TemplateException
name - an optional theme.variable - the variable.readonly - the readonly option.request - the servlet request.response - the servlet response.chain - the filter chain.
TemplateException - on errors.
void render(String template,
Variable variable,
ServletRequest request,
ServletResponse response,
FilterChain chain)
throws TemplateException
template - the template.variable - the variable.request - the servlet request.response - the servlet response.chain - the filter chain.
TemplateException - on errors.
void render(String name,
Variable variable,
MBeanAttributeInfo attribute,
boolean readonly,
ServletRequest request,
ServletResponse response,
FilterChain chain)
throws TemplateException
name - an optional theme.variable - the variable.attribute - the attribute.readonly - the read-only option.request - the servlet request.response - the servlet response.chain - the filter chain.
TemplateException - on errors.
void render(String template,
Variable variable,
MBeanAttributeInfo attribute,