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

      public static String encodeUrl(String queryString)
      Generic function to easily call url encoding with OFBiz rules
      Parameters:
      queryString -
      Returns:
      encoding url with OFBiz rule
    • encodeUrl

      public static String encodeUrl(String queryString, Map<String,Object> context)
      Check if an escapeUrlEncode is present in the context, to escape url encoding in a specific case This is necessary if the url is sent to another encoding tool.
      Parameters:
      queryString -
      context -
      Returns:
      encoding url with OFBiz rule
    • 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 -