Class UtilCodec


  • public class UtilCodec
    extends java.lang.Object
    • Constructor Detail

      • UtilCodec

        public UtilCodec()
    • Method Detail

      • canonicalize

        public static java.lang.String canonicalize​(java.lang.String input,
                                                    boolean restrictMultiple,
                                                    boolean restrictMixed)
      • checkStringForHtmlStrictNone

        public static java.lang.String checkStringForHtmlStrictNone​(java.lang.String valueName,
                                                                    java.lang.String value,
                                                                    java.util.List<java.lang.String> errorMessageList,
                                                                    java.util.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 java.lang.String checkStringForHtmlSafe​(java.lang.String valueName,
                                                              java.lang.String value,
                                                              java.util.List<java.lang.String> errorMessageList,
                                                              java.util.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 -