|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wiki.ui.InputValidator
public final class InputValidator
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.
Field Summary | |
---|---|
static int |
EMAIL
Input validator for e-mail addresses. |
protected static Pattern |
EMAIL_PATTERN
|
static int |
ID
|
protected static Pattern |
ID_PATTERN
Used when checking against IDs such as a full name when saving groups. |
static int |
STANDARD
Standard input validator. |
protected static Pattern |
UNSAFE_PATTERN
|
Constructor Summary | |
---|---|
InputValidator(String form,
WikiContext context)
Constructs a new input validator for a specific form and wiki session. |
Method Summary | |
---|---|
static boolean |
isBlank(String input)
Returns true if a supplied string is null or blank |
boolean |
validate(String input,
String label,
int type)
Validates a string against a particular pattern type: e-mail address, standard HTML input, etc. |
boolean |
validateNotNull(String input,
String label)
Validates a string against the STANDARD validator and
additionally checks that the value is not null or blank. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STANDARD
public static final int EMAIL
public static final int ID
protected static final Pattern EMAIL_PATTERN
protected static final Pattern UNSAFE_PATTERN
protected static final Pattern ID_PATTERN
Constructor Detail |
---|
public InputValidator(String form, WikiContext context)
form
- the ID or name of the form this validator should be
associated withcontext
- the wiki contextMethod Detail |
---|
public boolean validateNotNull(String input, String label)
STANDARD
validator and
additionally checks that the value is not null
or blank.
input
- the string to validatelabel
- the label for the string or field ("E-mail address")
true
if valid, false
otherwisepublic boolean validateNotNull(String input, String label, int type)
null
or blank. Delegates to
validate(String, String, int)
.
input
- the string to validatelabel
- the label for the string or field ("E-mail address")type
- the pattern type to use (e.g., STANDARD
, EMAIL
.
true
if valid, false
otherwisepublic boolean validate(String input, String label, int type)
input
- the string to validatelabel
- the label for the string or field ("E-mail address")type
- the target pattern to validate against (STANDARD
,
EMAIL
)
true
if valid, false
otherwisepublic static boolean isBlank(String input)
true
if a supplied string is null or blank
input
- the string to check
true
if null
or blank (zero-length);
false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |