Package org.apache.ofbiz.base.util
Class UtilCodec
- java.lang.Object
-
- org.apache.ofbiz.base.util.UtilCodec
-
public class UtilCodec extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UtilCodec.HtmlEncoder
static class
UtilCodec.HtmlEncodingMapWrapper<K>
A simple Map wrapper class that will do HTML encoding.static class
UtilCodec.IntrusionException
static interface
UtilCodec.SimpleDecoder
static interface
UtilCodec.SimpleEncoder
static class
UtilCodec.StringEncoder
static class
UtilCodec.UrlCodec
static class
UtilCodec.XmlEncoder
-
Constructor Summary
Constructors Constructor Description UtilCodec()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
canonicalize(java.lang.String value)
static java.lang.String
canonicalize(java.lang.String value, boolean strict)
static java.lang.String
canonicalize(java.lang.String input, boolean restrictMultiple, boolean restrictMixed)
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.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.static UtilCodec.SimpleDecoder
getDecoder(java.lang.String type)
static UtilCodec.SimpleEncoder
getEncoder(java.lang.String type)
-
-
-
Method Detail
-
getEncoder
public static UtilCodec.SimpleEncoder getEncoder(java.lang.String type)
-
getDecoder
public static UtilCodec.SimpleDecoder getDecoder(java.lang.String type)
-
canonicalize
public static java.lang.String canonicalize(java.lang.String value) throws UtilCodec.IntrusionException
- Throws:
UtilCodec.IntrusionException
-
canonicalize
public static java.lang.String canonicalize(java.lang.String value, boolean strict) throws UtilCodec.IntrusionException
- Throws:
UtilCodec.IntrusionException
-
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).- Parameters:
valueName
- field name checkedvalue
- value checkederrorMessageList
- an empty list passed by and modified in case of issueslocale
-
-
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 implementSanitizerCustomPolicy
.- Parameters:
valueName
- field name checkedvalue
- value checkederrorMessageList
- an empty list passed by and modified in case of issueslocale
-
-
-