Class UtilCodec

java.lang.Object
org.apache.ofbiz.base.util.UtilCodec

public class UtilCodec extends Object
  • Constructor Details

    • UtilCodec

      public UtilCodec()
  • Method Details

    • getEncoder

      public static UtilCodec.SimpleEncoder getEncoder(String type)
    • getDecoder

      public static UtilCodec.SimpleDecoder getDecoder(String type)
    • canonicalize

      public static String canonicalize(String value) throws UtilCodec.IntrusionException
      Throws:
      UtilCodec.IntrusionException
    • canonicalize

      public static String canonicalize(String value, boolean strict) throws UtilCodec.IntrusionException
      Throws:
      UtilCodec.IntrusionException
    • canonicalize

      public static String canonicalize(String input, boolean restrictMultiple, boolean restrictMixed)
    • checkStringForHtmlStrictNone

      public static String checkStringForHtmlStrictNone(String valueName, String value, List<String> errorMessageList, Locale locale)
      Uses a black-list approach for necessary characters for HTML. Does not allow various characters (after canonicalization), including "<", ">", "&" and "%" (if not followed by a space). Also does not allow js events as in OFBIZ-10054
      Parameters:
      valueName - field name checked
      value - value checked
      errorMessageList - an empty list passed by and modified in case of issues
      locale -
    • checkStringForHtmlSafe

      public static String checkStringForHtmlSafe(String valueName, String value, List<String> errorMessageList, Locale locale, boolean enableSanitizer)
      This method check if the input is safe HTML. It is possible to configure a safe policy using the properties "sanitizer.safe.policy" and "sanitizer.custom.safe.policy.class". The safe policy has to implement SanitizerCustomPolicy.
      Parameters:
      valueName - field name checked
      value - value checked
      errorMessageList - an empty list passed by and modified in case of issues
      locale -