Enum Class FieldType

java.lang.Object
java.lang.Enum<FieldType>
fr.paris.lutece.portal.web.xss.FieldType
All Implemented Interfaces:
Serializable, Comparable<FieldType>, Constable

public enum FieldType extends Enum<FieldType>
Semantic type of a user-editable field, used by 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 Constants
    Enum Constant
    Description
    CSS 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 Type
    Method
    Description
    boolean
    Indicates whether a field of this type must bypass the global XSS sanitizer filter of the form.
    static FieldType
    Returns the enum constant of this class with the specified name.
    static FieldType[]
    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

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • 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 Details

    • values

      public static FieldType[] 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

      public static FieldType valueOf(String name)
      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 name
      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: a URL carries = and & in its query string, a COLOR starts with #, and HTML carries markup. EMAIL and TEXT do 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.

      Returns:
      true for URL, COLOR and HTML, false otherwise