Class XssSafeValueFormatter
java.lang.Object
com.aquima.interactions.project.impl.XssSafeValueFormatter
- All Implemented Interfaces:
IValueFormatter
,Serializable
ValueFormatter wrapper that filters the HTML encodes string values.
- Since:
- 9.6
- Author:
- Radu Batori, MihaiBob
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionXssSafeValueFormatter
(IValueFormatter delegate) Constructs the ValueFormatter with the formatter that should be made XSS safe. -
Method Summary
Modifier and TypeMethodDescriptionformat
(IPrimitiveValue valueObject) Nothing to do, delegate to the underlying formatter.static XssSafeValueFormatter
The default XssSafeValueFormatter instance can be used for general XSS-escaping where actual formatting is not important.static boolean
This method parses the text to a IPrimitiveValue of the type specified by the data type argument.static IXssBlacklist
register
(IXssBlacklist newBlacklist) Registers a new blacklist implementation.static IXssWhitelist
register
(IXssWhitelist newWhitelist) Registers a new whitelist implementation.static String
-
Constructor Details
-
XssSafeValueFormatter
Constructs the ValueFormatter with the formatter that should be made XSS safe.- Parameters:
delegate
- The formatter that should be wrapped.
-
-
Method Details
-
getDefaultInstance
The default XssSafeValueFormatter instance can be used for general XSS-escaping where actual formatting is not important. Safe to use on Strings only.- Returns:
- the general-purpose default instance for XSS-escaping strings
-
register
Registers a new blacklist implementation.- Parameters:
newBlacklist
- the new blacklist implementation- Returns:
- the old blacklist that was replaced.
-
register
Registers a new whitelist implementation.- Parameters:
newWhitelist
- the new whitelist implementation- Returns:
- the old whitelist that was replaced.
-
format
Nothing to do, delegate to the underlying formatter.- Specified by:
format
in interfaceIValueFormatter
- Parameters:
valueObject
- The primitive value whose string representation is requested.- Returns:
- String representation of the primitive value.
-
parse
Description copied from interface:IValueFormatter
This method parses the text to a IPrimitiveValue of the type specified by the data type argument.- Specified by:
parse
in interfaceIValueFormatter
- Parameters:
text
- The input text which should be parsed. Preferably String. However some primitive object handling is included.type
- The data type to which the string should be converted.- Returns:
- The primitive value for the specified data type and text.
-
isValid
-
sanitize
-