Package org.apache.wiki.ui
Class InputValidator
- java.lang.Object
- 
- org.apache.wiki.ui.InputValidator
 
- 
 public final class InputValidator extends java.lang.Object 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.- Since:
- 2.3.54
 
- 
- 
Constructor SummaryConstructors Constructor Description InputValidator(java.lang.String form, Context context)Constructs a new input validator for a specific form and wiki session.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanisBlank(java.lang.String input)Returnstrueif a supplied string is null or blankbooleanvalidate(java.lang.String input, java.lang.String label, int type)Validates a string against a particular pattern type: e-mail address, standard HTML input, etc.booleanvalidateNotNull(java.lang.String input, java.lang.String label)Validates a string against theSTANDARDvalidator and additionally checks that the value is notnullor blank.booleanvalidateNotNull(java.lang.String input, java.lang.String label, int type)Validates a string against a particular pattern type and additionally checks that the value is notnullor blank.
 
- 
- 
- 
Field Detail- 
STANDARDpublic static final int STANDARD Standard input validator.- See Also:
- Constant Field Values
 
 - 
EMAILpublic static final int EMAIL Input validator for e-mail addresses.- See Also:
- Constant Field Values
 
 - 
IDpublic static final int ID - Since:
- 2.4.82
- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
InputValidatorpublic InputValidator(java.lang.String form, Context context) 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 be associated with
- context- the wiki context
 
 
- 
 - 
Method Detail- 
validateNotNullpublic boolean validateNotNull(java.lang.String input, java.lang.String label) Validates a string against theSTANDARDvalidator and additionally checks that the value is notnullor blank.- Parameters:
- input- the string to validate
- label- the label for the string or field ("E-mail address")
- Returns:
- returns trueif valid,falseotherwise
 
 - 
validateNotNullpublic boolean validateNotNull(java.lang.String input, java.lang.String label, int type) Validates a string against a particular pattern type and additionally checks that the value is notnullor blank. Delegates tovalidate(String, String, int).
 - 
validatepublic boolean validate(java.lang.String input, java.lang.String label, int type) 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.
 - 
isBlankpublic static boolean isBlank(java.lang.String input) Returnstrueif a supplied string is null or blank- Parameters:
- input- the string to check
- Returns:
- trueif- nullor blank (zero-length);- falseotherwise
 
 
- 
 
-