public class RhnValidationHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
getFailedValidation(javax.servlet.http.HttpServletRequest request)
Check the request to see if an Action indicated that a form failed its
validation process.
|
static boolean |
isValidEmailAddress(java.lang.String email)
Return
true if email is a valid email
address |
static void |
setFailedValidation(javax.servlet.http.HttpServletRequest request)
Place a flag in the request to indicate that the form failed its
validation This can be used by SetupActions to determine if they should
fill out the form with default values or not.
|
static ValidatorResult |
validate(java.lang.Class base,
java.lang.Object toValidate,
java.util.List fieldNames,
java.lang.String xsdName)
Validate a DynaActionForm from an class and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the class under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn/frontend/action/validation/loginForm.xsd
Sometimes, you want to use a given form and validation for a variety of
actions, which may not all belong in the same package hierarchy.
|
static ValidatorResult |
validate(java.lang.Object toValidate,
java.lang.String xsdPath)
Validate a DynaActionForm from an class and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the class under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn/frontend/action/validation/loginForm.xsd
Sometimes, you want to use a given form and validation for a variety of
actions, which may not all belong in the same package hierarchy.
|
static org.apache.struts.action.ActionErrors |
validateDynaActionForm(org.apache.struts.action.Action action,
org.apache.struts.action.DynaActionForm form)
Validate a DynaActionForm from an Action and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the Action under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn/frontend/action/validation/loginForm.xsd
|
static org.apache.struts.action.ActionErrors |
validateDynaActionForm(org.apache.struts.action.Action action,
org.apache.struts.action.DynaActionForm form,
java.util.List fieldNames)
Validate a DynaActionForm from an Action and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the Action under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn.frontend/action/validation/loginForm.xsd
|
static org.apache.struts.action.ActionErrors |
validateDynaActionForm(java.lang.Class base,
org.apache.struts.action.DynaActionForm form)
Validate a DynaActionForm from an class and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the class under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn/frontend/action/validation/loginForm.xsd
|
static org.apache.struts.action.ActionErrors |
validateDynaActionForm(java.lang.Class base,
org.apache.struts.action.DynaActionForm form,
java.util.List fieldNames)
Validate a DynaActionForm from an class and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the class under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn/frontend/action/validation/loginForm.xsd
Sometimes, you want to use a given form and validation for a variety of
actions, which may not all belong in the same package hierarchy.
|
static org.apache.struts.action.ActionErrors |
validateDynaActionForm(java.lang.Class base,
org.apache.struts.action.DynaActionForm form,
java.util.List fieldNames,
java.lang.String xsdName)
Validate a DynaActionForm from an class and get back the set of
ActionErrors This method expects there to be an XSD file to use to
validate the Form with located in the same package as the class under a
subdir named: validation/
For example, com.redhat.rhn.frontend.action.LoginAction has an associated
loginForm in Struts, so you would need a:
com/redhat/rhn/frontend/action/validation/loginForm.xsd
Sometimes, you want to use a given form and validation for a variety of
actions, which may not all belong in the same package hierarchy.
|
static org.apache.struts.action.ActionErrors |
validatorErrorToActionErrors(ValidatorError... errors)
Converts an array of Strings into a set of ActionError messages
|
static org.apache.struts.action.ActionMessages |
validatorWarningToActionMessages(ValidatorWarning... warnings)
Converts an array of ValidatorWarnings into a set of ActionMessages.
|
public static org.apache.struts.action.ActionErrors validatorErrorToActionErrors(ValidatorError... errors)
errors
- Array of ValidatorErrors you want to convertpublic static org.apache.struts.action.ActionMessages validatorWarningToActionMessages(ValidatorWarning... warnings)
warnings
- Array of ValidatorWarnings you want to convertpublic static org.apache.struts.action.ActionErrors validateDynaActionForm(org.apache.struts.action.Action action, org.apache.struts.action.DynaActionForm form)
action
- The action associated with the formform
- The form to validatepublic static org.apache.struts.action.ActionErrors validateDynaActionForm(org.apache.struts.action.Action action, org.apache.struts.action.DynaActionForm form, java.util.List fieldNames)
action
- The action associated with the formform
- The form to validatefieldNames
- List of form field names to validatepublic static org.apache.struts.action.ActionErrors validateDynaActionForm(java.lang.Class base, org.apache.struts.action.DynaActionForm form)
base
- the base from which to lookup the validatorform
- The form to validatepublic static org.apache.struts.action.ActionErrors validateDynaActionForm(java.lang.Class base, org.apache.struts.action.DynaActionForm form, java.util.List fieldNames)
base
- the base from which to lookup the validatorform
- The form to validatefieldNames
- List of field names to validatepublic static org.apache.struts.action.ActionErrors validateDynaActionForm(java.lang.Class base, org.apache.struts.action.DynaActionForm form, java.util.List fieldNames, java.lang.String xsdName)
base
- the base from which to lookup the validatorform
- The form to validatefieldNames
- List of field names to validatexsdName
- the fully-qualified pathname to the XSD that we want to
validate against, or "null" if we want to use the dead-reckoning approachpublic static ValidatorResult validate(java.lang.Class base, java.lang.Object toValidate, java.util.List fieldNames, java.lang.String xsdName)
base
- the base from which to lookup the validatortoValidate
- The form to validatefieldNames
- List of field names to validatexsdName
- the fully-qualified pathname to the XSD that we want to
validate against.public static ValidatorResult validate(java.lang.Object toValidate, java.lang.String xsdPath)
toValidate
- The form to validatexsdPath
- the fully-qualified pathname to the XSD that we want to
validate against.public static void setFailedValidation(javax.servlet.http.HttpServletRequest request)
request
- Set the attribute on this requestpublic static boolean getFailedValidation(javax.servlet.http.HttpServletRequest request)
request
- to check to see if validation failedpublic static boolean isValidEmailAddress(java.lang.String email)
true
if email
is a valid email
addressemail
- the email to validatetrue
if email
is a valid email
addressInternetAddress.validate()