| java.lang.Object com.ecyrd.jspwiki.ui.InputValidator
InputValidator | final public class InputValidator (Code) | | Provides basic validation services for HTTP parameters. Three standard
validators are provided: email address, identifier and standard input. Standard input
validator will reject any HTML-like input, and any of a number of special
characters. ID validator rejects HTML and quoted strings, and a couple of special characters.
author: Andrew Jaquith since: 2.3.54 |
Method Summary | |
final public static boolean | isBlank(String input) | final public boolean | validate(String input, String label, int type) Validates a string against a particular pattern type: e-mail address,
standard HTML input, etc. | final public boolean | validateNotNull(String input, String label) Validates a string against the
InputValidator.STANDARD validator and
additionally checks that the value is not null or blank. | final public boolean | validateNotNull(String input, String label, int type) Validates a string against a particular pattern type and additionally
checks that the value is not null or blank. |
EMAIL | final public static int EMAIL(Code) | | Input validator for e-mail addresses. *
|
ID | final public static int ID(Code) | | since: 2.4.82 |
ID_PATTERN | final protected static Pattern ID_PATTERN(Code) | | Used when checking against IDs such as a full name when saving groups.
since: 2.4.82 |
STANDARD | final public static int STANDARD(Code) | | Standard input validator.
|
UNSAFE_PATTERN | final protected static Pattern UNSAFE_PATTERN(Code) | | |
InputValidator | public InputValidator(String form, WikiSession session)(Code) | | Constructs a new input validator for a specific form and wiki session.
When validation errors are detected, they will be added to the wiki
session's messages.
Parameters: form - the ID or name of the form this validator should beassociated with Parameters: session - the wiki session |
isBlank | final public static boolean isBlank(String input)(Code) | | Returns true if a supplied string is null or blank
Parameters: input - the string to check true if null or blank (zero-length);false otherwise |
validate | final public boolean validate(String input, String label, int type)(Code) | | Validates a string against a particular pattern type: e-mail address,
standard HTML input, etc. Note that a blank or null string will
always validate.
Parameters: input - the string to validate Parameters: label - the label for the string or field ("E-mail address") Parameters: type - the target pattern to validate against (InputValidator.STANDARD,InputValidator.EMAIL) returns true if valid, false otherwise |
validateNotNull | final public boolean validateNotNull(String input, String label)(Code) | | Validates a string against the
InputValidator.STANDARD validator and
additionally checks that the value is not null or blank.
Parameters: input - the string to validate Parameters: label - the label for the string or field ("E-mail address") returns true if valid, false otherwise |
validateNotNull | final public boolean validateNotNull(String input, String label, int type)(Code) | | Validates a string against a particular pattern type and additionally
checks that the value is not null or blank. Delegates to
InputValidator.validate(String,String,int) .
Parameters: input - the string to validate Parameters: label - the label for the string or field ("E-mail address") Parameters: type - the pattern type to use (e.g., #STANDARD, #EMAIL. returns true if valid, false otherwise |
|
|