Enum FieldType
- java.lang.Object
-
- java.lang.Enum<FieldType>
-
- fr.paris.lutece.portal.web.xss.FieldType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<FieldType>
public enum FieldType extends java.lang.Enum<FieldType>
Semantic type of a user-editable field, used byFieldValidationServiceto 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
FieldTypeis the responsibility of the caller.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COLORCSS color value (#RGB,#RRGGBB,#RRGGBBAA,rgb()/rgba()).EMAILEmail address, validated against the email format.HTMLHTML content, sanitized with the XSS sanitizer allowlist.TEXTPlain text, left under the responsibility of the global XSS sanitizer filter.URLURL or resource path, validated structurally, on its scheme and on its query parameter values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanrequiresXssBypass()Indicates whether a field of this type must bypass the global XSS sanitizer filter of the form.static FieldTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static FieldType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
TEXT
public static final FieldType TEXT
Plain text, left under the responsibility of the global XSS sanitizer filter.
-
EMAIL
public static final FieldType EMAIL
Email address, validated against the email format.
-
URL
public static final FieldType URL
URL or resource path, validated structurally, on its scheme and on its query parameter values.
-
COLOR
public static final FieldType COLOR
CSS color value (#RGB,#RRGGBB,#RRGGBBAA,rgb()/rgba()).
-
HTML
public static final FieldType HTML
HTML content, sanitized with the XSS sanitizer allowlist.
-
-
Method Detail
-
values
public static FieldType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FieldType c : FieldType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FieldType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- 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.
-
-