Enum Class FieldType
- All Implemented Interfaces:
Serializable,Comparable<FieldType>,Constable
FieldValidationService to apply a dedicated validation or
sanitization strategy.
This type is independent from any particular feature: it can be reused by any form (site properties, plugin
configuration, admin forms, etc.) that needs a per-type validation. The mapping between a concrete field or datastore
key and its FieldType is the responsibility of the caller.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCSS color value (#RGB,#RRGGBB,#RRGGBBAA,rgb()/rgba()).Email address, validated against the email format.HTML content, sanitized with the XSS sanitizer allowlist.Plain text, left under the responsibility of the global XSS sanitizer filter.URL or resource path, validated structurally, on its scheme and on its query parameter values. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether a field of this type must bypass the global XSS sanitizer filter of the form.static FieldTypeReturns the enum constant of this class with the specified name.static FieldType[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
TEXT
Plain text, left under the responsibility of the global XSS sanitizer filter. -
EMAIL
Email address, validated against the email format. -
URL
URL or resource path, validated structurally, on its scheme and on its query parameter values. -
COLOR
CSS color value (#RGB,#RRGGBB,#RRGGBBAA,rgb()/rgba()). -
HTML
HTML content, sanitized with the XSS sanitizer allowlist.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
requiresXssBypass
public boolean requiresXssBypass()Indicates whether a field of this type must bypass the global XSS sanitizer filter of the form.The global filter strips a configured set of characters (see
lutece.safe.request.site.xssCharacters, typically<>#"&). A type requires the bypass only when its legitimate content contains such characters: aURLcarries=and&in its query string, aCOLORstarts with#, andHTMLcarries markup.EMAILandTEXTdo not require the bypass: a valid email contains none of the filtered characters and is only validated, and plain text stays under the global filter.
-