|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.util.ClickUtils
public class ClickUtils
Provides miscellaneous Form, String and Stream utility methods.
Field Summary | |
---|---|
static String |
DEFAULT_APP_CONFIG
The default Click configuration filename: "/WEB-INF/click.xml". |
static String |
ENABLE_RESOURCE_VERSION
The resource versioning request attribute: key: enable-resource-version. |
static String |
RESOURCE_VERSION_INDICATOR
The static web resource version number indicator string. |
static String |
VERSION_INDICATOR_SEP
The version indicator separator string. |
Constructor Summary | |
---|---|
ClickUtils()
|
Method Summary | |
---|---|
static void |
autoPostRedirect(HttpServletRequest request,
HttpServletResponse response,
String target,
Map<?,?> params,
boolean compress)
Perform an auto post redirect to the specified target using the given response. |
static void |
bind(AbstractLink link)
A helper method that binds the submitted request value to the Link's value. |
static void |
bind(Container container)
A helper method that binds the submitted request values of all Fields and Links inside the given container or child containers. |
static void |
bind(Field field)
A helper method that binds the submitted request value to the Field's value. |
static boolean |
bindAndValidate(Container container)
A helper method that binds and validates the submitted request values of all Fields and Links inside the given container or child containers. |
static boolean |
bindAndValidate(Field field)
A helper method that binds and validates the Field's submitted request value. |
static boolean |
bindAndValidate(Form form)
* A helper method that binds and validates the submitted request values of all Fields and Links inside the given Form or child containers. |
static Document |
buildDocument(InputStream inputStream)
Return a new XML Document for the given input stream. |
static Document |
buildDocument(InputStream inputStream,
EntityResolver entityResolver)
Return a new XML Document for the given input stream and XML entity resolver. |
static boolean |
canBind(Control control,
Context context)
Return true if the given control's request value can be bound, false otherwise. |
static Class |
classForName(String classname)
Returns the Class object associated with the class or
interface with the given string name, using the current Thread context
class loader. |
static void |
close(Closeable closeable)
Close the given closeable (Reader, Writer, Stream) and ignore any exceptions thrown. |
static void |
copyFormToObject(Form form,
Object object,
boolean debug)
Populate the given object's attributes with the Form's field values. |
static void |
copyObjectToForm(Object object,
Form form,
boolean debug)
Populate the given Form field values with the object's attributes. |
static Map<String,Object> |
createTemplateModel(Page page,
Context context)
Creates a template model of key/value pairs which can be used by template engines such as Velocity and Freemarker. |
static Object |
decode(String string)
Return an object from the encode(Object) string. |
static String[] |
decodePasswordCookie(String cookieVal,
int xorMask)
Decodes a cookie string containing a username and password. |
static String[] |
decodePasswordCookie(String cookieVal,
String encoding,
int xorMask)
Decodes a cookie string containing a username and password. |
static String |
decodeURL(Object value)
URL decode the specified value using the "UTF-8" encoding scheme. |
static void |
deployFile(ServletContext servletContext,
String resource,
String targetDir)
Deploy the specified classpath resource to the given target directory under the web application root directory. |
static void |
deployFileList(ServletContext servletContext,
Class<? extends Control> controlClass,
String targetDir)
Deploys required files (from a file list) for a control that repsects a specific convention. |
static void |
deployFiles(ServletContext servletContext,
String[] resources,
String targetDir)
Deploy the specified classpath resources to the given target directory under the web application root directory. |
static String |
encode(Object object)
Return an encoded version of the Serializable object. |
static String |
encodePasswordCookie(String username,
String password,
int xorMask)
Builds a cookie string containing a username and password. |
static String |
encodePasswordCookie(String username,
String password,
String encoding,
int xorMask)
Builds a cookie string containing a username and password, using offsets to customize the encoding. |
static String |
encodeURL(Object value)
URL encode the specified value using the "UTF-8" encoding scheme. |
static String |
encodeUrl(Object object,
Context context)
Return an encoded URL value for the given object using the context request character encoding or "UTF-8" if the request character encoding is not specified. |
static String |
escape(String value)
Return an escaped string for the given string value. |
static String |
escapeHtml(String value)
Return a HTML escaped string for the given string value. |
static String |
getApplicationResourceVersionIndicator()
If resource versioning is active this method will return the application version indicator for static web resources (eg JavaScript and Css) otherwise this method will return an empty string. |
static String |
getApplicationVersion()
Return the web application version string. |
static ResourceBundle |
getBundle(String baseName)
Return a resource bundle using the specified base name. |
static ResourceBundle |
getBundle(String baseName,
Locale locale)
Return a resource bundle using the specified base name and locale. |
static Element |
getChild(Element parent,
String name)
Return the first XML child Element for the given parent Element and child Element name. |
static List<Element> |
getChildren(Element parent,
String name)
Return the list of XML child Element elements with the given name from the given parent Element. |
static InputStream |
getClickConfig(ServletContext servletContext)
Return the InputStream for the Click configuration file click.xml. |
static String |
getClickVersion()
Return the Click Framework version string. |
static ConfigService |
getConfigService(ServletContext servletContext)
Return the application configuration service instance from the given servlet context. |
static Cookie |
getCookie(HttpServletRequest request,
String name)
Returns the specified Cookie object, or null if the cookie does not exist. |
static String |
getCookieValue(HttpServletRequest request,
String name)
Returns the value of the specified cookie as a String. |
static String |
getCssSelector(Control control)
Return the given control CSS selector or null if no selector can be found. |
static List<Field> |
getFormFields(Form form)
Return the list of Fields for the given Form, including any Fields contained in FieldSets. |
static LogService |
getLogService()
Return the application LogService instance using thread local Context to perform the lookup. |
static String |
getMimeType(String value)
Return the mime-type or content-type for the given filename/extension. |
static String |
getParentMessage(Control control,
String name)
Return the given control's top level parent's localized message for the specified name. |
static Map<String,String> |
getParentMessages(Control control)
Return the given control's top level parent's localized messages Map. |
static Page |
getParentPage(Control control)
Get the parent page of the given control or null if the control has no parent. |
static Map<String,Object> |
getRequestParameterMap(HttpServletRequest request)
Return an ordered map of request parameters from the given request. |
static String |
getRequestURI(HttpServletRequest request)
Return the requestURI from the request. |
static URL |
getResource(String name,
Class<?> aClass)
Finds a resource with a given name. |
static InputStream |
getResourceAsStream(String name,
Class<?> aClass)
Finds a resource with a given name. |
static String |
getResourcePath(HttpServletRequest request)
Return the page resource path from the request. |
static String |
getResourceVersionIndicator(Context context)
Return Click's version indicator for static web resources (eg css, js and image files) if resource versioning is active, otherwise this method will return an empty string. |
static boolean |
hasRequestParameter(Control control)
Return true if the control has a submitted request value, false otherwise. |
static void |
invalidateCookie(HttpServletRequest request,
HttpServletResponse response,
String cookieName)
Invalidate the specified cookie and delete it from the response object. |
static void |
invalidateCookie(HttpServletRequest request,
HttpServletResponse response,
String cookieName,
String path)
Invalidate the specified cookie and delete it from the response object. |
static ActionResult |
invokeAction(Object target,
String method)
Invoke the named method on the given target and return the Object result. |
static boolean |
invokeListener(Object listener,
String method)
Invoke the named method on the given object and return the boolean result. |
static boolean |
isAjaxRequest(HttpServletRequest request)
Return true is this is an Ajax request, false otherwise. |
static boolean |
isEnableResourceVersion(Context context)
Return true if static web content resource versioning is enabled. |
static boolean |
isMultipartRequest(HttpServletRequest request)
Return true if the request is a multi-part content type POST request. |
static boolean |
isResourcesDeployable(ServletContext servletContext)
Returns true if Click resources (JavaScript, CSS, images etc) packaged in jars can be deployed to the root directory of the webapp, false otherwise. |
static String |
limitLength(String value,
int maxlength)
Return the value string limited to maxlength characters. |
static String |
limitLength(String value,
int maxlength,
String suffix)
Return the value string limited to maxlength characters. |
static void |
removeState(Stateful control,
String controlName,
Context context)
Remove the control state from the session for the given stateful control, control name and request context. |
static void |
restoreState(Stateful control,
String controlName,
Context context)
Restore the control state from the session for the given stateful control, control name and request context. |
static void |
saveState(Stateful control,
String controlName,
Context context)
Save the control state in the session for the given stateful control, control name and request context. |
static void |
setApplicationVersion(String applicationVersion)
Set the web application version string. |
static Cookie |
setCookie(HttpServletRequest request,
HttpServletResponse response,
String name,
String value,
int maxAge,
String path)
Sets the given cookie values in the servlet response. |
static String |
toGetterName(String property)
Return the getter method name for the given property name. |
static String |
toIsGetterName(String property)
Return the is getter method name for the given property name. |
static String |
toLabel(String name)
Return a field label string from the given field name. |
static String |
toMD5Hash(String plaintext)
Return an 32 char MD5 encoded string from the given plain text. |
static String |
toName(String label)
Return a field name string from the given field label. |
static String |
toSetterName(String property)
Return the setter method name for the given property name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ENABLE_RESOURCE_VERSION
Control.getHeadElements()
will have a
version indicator added to their path.
Control.getHeadElements()
,
getResourceVersionIndicator(Context)
,
Constant Field Valuespublic static final String DEFAULT_APP_CONFIG
public static final String VERSION_INDICATOR_SEP
public static final String RESOURCE_VERSION_INDICATOR
Constructor Detail |
---|
public ClickUtils()
Method Detail |
---|
public static void autoPostRedirect(HttpServletRequest request, HttpServletResponse response, String target, Map<?,?> params, boolean compress)
request
- the servlet requestresponse
- the servlet responsetarget
- the target URL to send the auto post redirect toparams
- the map of parameter values to postcompress
- the flag to specify whether to attempt gzip compression
of the response contentpublic static void bind(Field field)
canBind(org.apache.click.Control, org.apache.click.Context)
to check if the Field value can be bound.
public void onInit() { Form form = new Form("form"); Select select = new Select("select"); select.setAttribute("onchange", "Click.submit(form, false)"); // Bind the select Field request value ClickUtils.bind(select); if (select.getValue() == COMPANY) { form.add(new TextField("companyName")); } else { form.add(new TextField("fullname")); form.add(new TextField("age")); } }
field
- the Field to bindpublic static void bind(AbstractLink link)
bind(org.apache.click.control.Field)
for a detailed
description.
This method delegates to
canBind(org.apache.click.Control, org.apache.click.Context)
to check if the Link value can be bound.
link
- the AbstractLink to bindpublic static void bind(Container container)
bind(org.apache.click.control.Field)
for a detailed description.
This method delegates to
canBind(org.apache.click.Control, org.apache.click.Context)
to check if the Container Fields and Links can be bound.
Below is an example to bind Form Field's during the onInit event:
public void onInit() { Form form = new Form("form"); Checkbox commentChk = new Checkbox("comment"); Select select = new Select("select"); select.setAttribute("onchange", "Click.submit(form, false)"); // Bind all Form Field request values ClickUtils.bind(form); if (select.getValue() == COMPANY) { form.add(new TextField("companyName")); } else { form.add(new TextField("fullname")); form.add(new TextField("age")); } if (commentChk.isChecked()) { form.add(new TextArea("feedback")); } }
container
- the container which Fields and Links to bindpublic static boolean bindAndValidate(Field field)
bind(org.apache.click.control.Field)
for a
detailed description.
This method delegates to
canBind(org.apache.click.Control, org.apache.click.Context)
to check if the Field value can be bound and validated.
Please note: this method won't bind and validate disabled fields,
unless the field has an incoming request parameter matching its name.
If an incoming request parameter is present, this method will switch off
the Field's disabled property.
public void onInit() { Form form = new Form("form"); Select select = new Select("select", true); select.addOption(Option.EMPTY_OPTION); select.setAttribute("onchange", "Click.submit(form, false)"); // Bind the Field request value and validate it before continuing if (ClickUtils.bindAndValidate(select)) { if (select.getValue() == COMPANY) { form.add(new TextField("companyName")); } else { form.add(new TextField("fullname")); form.add(new TextField("age")); } } }
field
- the Field to bind and validate
public static boolean bindAndValidate(Container container)
bindAndValidate(org.apache.click.control.Form)
for a
detailed description.
container
- the container which Fields and Links to bind and
validate
public static boolean bindAndValidate(Form form)
bind(org.apache.click.control.Field)
for a detailed
description.
This method delegates to
canBind(org.apache.click.Control, org.apache.click.Context)
to check if the Form Fields and Links can be bound and validated.
public void onInit() { Form form = new Form("form"); Checkbox commentChk = new Checkbox("comment"); Select select = new Select("select", true); select.addOption(Option.EMPTY_OPTION); select.setAttribute("onchange", "Click.submit(form, false)"); // Bind all Form field request values and validate it before continuing if (ClickUtils.bindAndValidate(form)) { if (select.getValue() == COMPANY) { form.add(new TextField("companyName")); } else { form.add(new TextField("fullname")); form.add(new TextField("age")); } if (commentChk.isChecked()) { form.add(new TextArea("feedback")); } } }
form
- the form which Fields and Links to bind and validate
public static Document buildDocument(InputStream inputStream)
inputStream
- the input stream
RuntimeException
- if a parsing error occurspublic static Document buildDocument(InputStream inputStream, EntityResolver entityResolver)
inputStream
- the input streamentityResolver
- the XML entity resolver
RuntimeException
- if a parsing error occurspublic static boolean canBind(Control control, Context context)
Context.isForward()
Context.isAjaxRequest()
Form.isFormSubmission()
control
- the control to check if it can be bound or notcontext
- the request context
public static Class classForName(String classname) throws ClassNotFoundException
Class
object associated with the class or
interface with the given string name, using the current Thread context
class loader.
classname
- the name of the class to load
ClassNotFoundException
- if the class cannot be locatedpublic static void close(Closeable closeable)
closeable
- the closeable (Reader, Writer, Stream) to close.public static Map<String,Object> createTemplateModel(Page page, Context context)
model
Map key/value
pairs
Format
object for formatting the display
of objects.
MessagesMap
adaptor for the
Page.getMessages()
method.
path
of the page
template.
HttpServletRequest
object.
HttpServletResponse
object.
SessionMap
adaptor for the users
HttpSession
.
page
- the page to populate the template model fromcontext
- the request context
public static void invalidateCookie(HttpServletRequest request, HttpServletResponse response, String cookieName, String path)
request
- the servlet requestresponse
- the servlet responsecookieName
- The name of the cookie you want to deletepath
- of the path the cookie you want to deletepublic static boolean isAjaxRequest(HttpServletRequest request)
request
- the servlet request
public static boolean isMultipartRequest(HttpServletRequest request)
request
- the page servlet request
public static void invalidateCookie(HttpServletRequest request, HttpServletResponse response, String cookieName)
invalidateCookie(HttpServletRequest, HttpServletResponse, String, String)
This method was derived from Atlassian CookieUtils method of
the same name, release under the BSD License.
request
- the servlet requestresponse
- the servlet responsecookieName
- The name of the cookie you want to delete.invalidateCookie(HttpServletRequest, HttpServletResponse, String, String)
public static ResourceBundle getBundle(String baseName)
baseName
- the base name of the resource bundle, a fully qualified class name
MissingResourceException
- if no resource bundle for the specified base name can be foundpublic static ResourceBundle getBundle(String baseName, Locale locale)
baseName
- the base name of the resource bundle, a fully qualified class namelocale
- the locale for which a resource bundle is desired
MissingResourceException
- if no resource bundle for the specified base name can be foundpublic static Element getChild(Element parent, String name)
parent
- the parent element to get the child fromname
- the name of the child element
public static List<Element> getChildren(Element parent, String name)
parent
- the parent element to get the child fromname
- the name of the child element
public static InputStream getClickConfig(ServletContext servletContext)
servletContext
- the servlet context to obtain the Click configuration
from
RuntimeException
- if the resource could not be foundpublic static ConfigService getConfigService(ServletContext servletContext)
servletContext
- the servlet context to get the config service instance
public static Cookie getCookie(HttpServletRequest request, String name)
request
- the servlet requestname
- the name of the cookie
public static Cookie setCookie(HttpServletRequest request, HttpServletResponse response, String name, String value, int maxAge, String path)
request
- the servlet requestresponse
- the servlet responsename
- the cookie namevalue
- the cookie valuemaxAge
- the maximum age of the cookie in seconds. A negative
value will expire the cookie at the end of the session, while 0 will delete
the cookie.path
- the cookie path
public static String getCookieValue(HttpServletRequest request, String name)
request
- the servlet requestname
- the name of the cookie
public static String getClickVersion()
public static String getApplicationVersion()
public static void setApplicationVersion(String applicationVersion)
applicationVersion
- the web application version stringpublic static String getResourceVersionIndicator(Context context)
ENABLE_RESOURCE_VERSION
request attribute must be set
to true
context
- the request context
public static String getApplicationResourceVersionIndicator()
ENABLE_RESOURCE_VERSION
request attribute must be set
to truesetApplicationVersion(java.lang.String)
.
public static String getCssSelector(Control control)
ActionLink
,
it's "class" attribute selector will be returned. For example:
a[class=red]. Please note: if the link class attribute is
not set, the class attribute will be set to its name, prefixed with
a dash, '-'. For example: a[class=-my-link].
control
- the control which CSS selector to return
IllegalArgumentException
- if control is nullpublic static void copyFormToObject(Form form, Object object, boolean debug)
Map
. If a POJO is specified, its attributes are
populated from matching form fields. If a map is specified, its
key/value pairs are populated from matching form fields.
form
- the Form to obtain field values fromobject
- the object to populate with field valuesdebug
- log debug statements when populating the objectpublic static void copyObjectToForm(Object object, Form form, boolean debug)
Map
. If a POJO is specified, its attributes are
copied to matching form fields. If a map is specified, its key/value
pairs are copied to matching form fields.
object
- the object to obtain attribute values fromform
- the Form to populatedebug
- log debug statements when populating the formpublic static void deployFile(ServletContext servletContext, String resource, String targetDir)
servletContext
- the web applications servlet contextresource
- the classpath resource nametargetDir
- the target directory to deploy the resource topublic static void deployFiles(ServletContext servletContext, String[] resources, String targetDir)
servletContext
- the web applications servlet contextresources
- the array of classpath resource namestargetDir
- the target directory to deploy the resource topublic static void deployFileList(ServletContext servletContext, Class<? extends Control> controlClass, String targetDir)
tools/standalone/dev-tasks/ListFilesTask
.
The files to deploy are all in a subdirectory placed in the same directory with the control.
See documentation for more details.
Usage:
In your Control simply use the code below, and everything should work automatically.
public void onDeploy(ServletContext servletContext) { ClickUtils.deployFileList(servletContext, HeavyControl.class, "click"); }
servletContext
- the web applications servlet contextcontrolClass
- the class of the Control that has files for deploymenttargetDir
- target directory where to deploy the files to. In most cases this
is only the reserved directory click
public static String encode(Object object) throws IOException
object
- the object to encode
IOException
- if an I/O error occurs
IllegalArgumentException
- if the object parameter is null, or if
the object is not Serializablepublic static Object decode(String string) throws ClassNotFoundException, IOException
encode(Object)
string.
string
- the encoded string
ClassNotFoundException
- if the class could not be instantiated
IOException
- if an data I/O error occurspublic static String encodePasswordCookie(String username, String password, int xorMask)
username
- the usernamepassword
- the passwordxorMask
- the XOR mask to encrypt the value with, must be same as
as the value used to decrypt the cookie password
null
public static String encodePasswordCookie(String username, String password, String encoding, int xorMask)
username
- the usernamepassword
- the passwordencoding
- a String used to customize cookie encoding (only the first 3 characters are used)xorMask
- the XOR mask to encrypt the value with, must be same as
as the value used to decrypt the cookie password
null
.public static String[] decodePasswordCookie(String cookieVal, int xorMask)
cookieVal
- the encoded cookie username and password valuexorMask
- the XOR mask to decrypt the value with, must be same as
as the value used to encrypt the cookie password
{ null, null }
if cookieVal equals
null
or the empty string.public static String[] decodePasswordCookie(String cookieVal, String encoding, int xorMask)
cookieVal
- the encoded cookie username and password valueencoding
- a String used to customize cookie encoding (only the first 3 characters are used)
- should be the same string you used to encode the cookie!xorMask
- the XOR mask to decrypt the value with, must be same as
as the value used to encrypt the cookie password
{ null, null }
if cookieVal equals
null
or the empty string.public static String encodeURL(Object value)
URLEncoder.encode(java.lang.String, java.lang.String)
internally.
value
- the value to encode using "UTF-8"
public static String decodeURL(Object value)
URLDecoder.decode(java.lang.String, java.lang.String)
internally.
value
- the value to decode using "UTF-8"
public static String encodeUrl(Object object, Context context)
URLEncoder.encode(java.lang.String, java.lang.String)
internally.
object
- the object value to encode as a URL stringcontext
- the context providing the request character encoding
public static String escapeHtml(String value)
value
- the string value to escape
public static String escape(String value)
value
- the string value to escape
public static boolean hasRequestParameter(Control control)
control
- the control which request parameter to check
public static boolean invokeListener(Object listener, String method)
listener
- the object with the method to invokemethod
- the name of the method to invoke
Control.setListener(Object, String)
public static ActionResult invokeAction(Object target, String method)
target
- the target object with the method to invokemethod
- the name of the method to invoke
public static boolean isEnableResourceVersion(Context context)
context
- the request context
public static String limitLength(String value, int maxlength)
value
- the string value to limit the length ofmaxlength
- the maximum string length
public static String limitLength(String value, int maxlength, String suffix)
value
- the string value to limit the length ofmaxlength
- the maximum string lengthsuffix
- the suffix to append to the length limited string
public static LogService getLogService()
public static List<Field> getFormFields(Form form)
form
- the form to obtain the fields from
public static String getMimeType(String value)
// Lookup mimetype for file String mimeType = ClickUtils.getMimeType("hello-world.pdf"); // Lookup mimetype for extension mimeType = ClickUtils.getMimeType("pdf");
value
- the filename or extension to obtain the mime-type for
public static Map<String,String> getParentMessages(Control control)
control
- the control to get the parent messages Map for
public static String getParentMessage(Control control, String name)
myfield.label=Pageand MyForm.properties
myfield.label=Formand a the following snippet:
public MyPage extends Page { public void onInit() { MyForm form = new MyForm("form"); TextField field = new TextField("myfield"); form.add(field); //1. System.out.println(ClickUtils.getParentMessage(field, "myfield.label")); addControl(form); //2. System.out.println(ClickUtils.getParentMessage(field, "myfield.label")); } }The first (1.) println statement above will output Form because at that stage MyForm is the highest level parent of field. getParentMessage will find the property myfield.label in the MyForm message properties and return Form The second (2.) println statement will output Page as now MyPage is the highest level parent. On its first pass up the hierarchy, getParentMessage will find the property myfield.label in the MyForm message properties and on its second pass will find the same property in MyPage message properties. As MyPage is higher up the hierarchy than MyForm, MyPage will override MyForm and the property value will be Page.
control
- the control to get the parent message forname
- the specific property name to find
public static Page getParentPage(Control control)
control
- the control to get the parent page from
public static Map<String,Object> getRequestParameterMap(HttpServletRequest request)
request
- the servlet request to obtain request parameters from
public static String getResourcePath(HttpServletRequest request)
http://www.mycorp.com/banking/secure/login.htm -> /secure/login.htm
request
- the page servlet request
public static String getRequestURI(HttpServletRequest request)
http://www.mycorp.com/banking/secure/login.htm -> /banking/secure/login.htm
request
- the page servlet request
public static InputStream getResourceAsStream(String name, Class<?> aClass)
This method uses the current Thread context ClassLoader to find the resource. If the resource is not found the class loader of the given class is then used to find the resource.
name
- the name of the resourceaClass
- the class lookup the resource against, if the resource is
not found using the current Thread context ClassLoader.
public static URL getResource(String name, Class<?> aClass)
This method uses the current Thread context ClassLoader to find the resource. If the resource is not found the class loader of the given class is then used to find the resource.
name
- the name of the resourceaClass
- the class lookup the resource against, if the resource is
not found using the current Thread context ClassLoader.
public static void removeState(Stateful control, String controlName, Context context)
control
- the stateful control which state to removecontrolName
- the name of the control which state to removecontext
- the request contextpublic static void restoreState(Stateful control, String controlName, Context context)
Stateful.setState(java.lang.Object)
to restore the control state.
control
- the stateful control which state to restorecontrolName
- the name of the control which state to restorecontext
- the request contextpublic static void saveState(Stateful control, String controlName, Context context)
Stateful.getState()
to retrieve the control state to save.
control
- the stateful control which state to savecontrolName
- the name of the control control which state to savecontext
- the request contextpublic static String toGetterName(String property)
property
- the property name
public static String toIsGetterName(String property)
property
- the property name
public static String toLabel(String name)
faxNumber -> Fax NumberNote toLabel will return an empty String ("") if a null String name is specified.
name
- the field name
public static String toMD5Hash(String plaintext)
plaintext
- the plain text value to encode
public static String toName(String label)
label
- the field label or caption
public static String toSetterName(String property)
property
- the property name
public static boolean isResourcesDeployable(ServletContext servletContext)
servletContext
- the application servlet context
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |