Package org.opencms.ugc
Class CmsUgcValueTranformHandler
java.lang.Object
org.opencms.ugc.CmsUgcValueTranformHandler
The class transforms the values that should be written to an XML content via UGC according to a
content type specific value transformation configuration.
By default all values are xml escaped to void XSS issues when content that is created via UGC is
rendered on a webpage without any extra caution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CmsUgcValueTranformHandler
The default value transformer. -
Constructor Summary
ConstructorsConstructorDescriptionCmsUgcValueTranformHandler
(CmsObject cms, CmsResource resource) Creates the value transformer instance for the provided resource. -
Method Summary
Modifier and TypeMethodDescriptiontransformValue
(String path, String value) The method applies the configured value transformer to the given value.
-
Field Details
-
DEFAULT
The default value transformer.
-
-
Constructor Details
-
CmsUgcValueTranformHandler
public CmsUgcValueTranformHandler(CmsObject cms, CmsResource resource) throws CmsXmlException, CmsException, IllegalArgumentException, JSONException Creates the value transformer instance for the provided resource.- Parameters:
cms
- the contextresource
- the resource of the XML content to get the mapping security for- Throws:
CmsXmlException
- thrown if the content can't be unmarshalledCmsException
- thrown if the content can't be readIllegalArgumentException
- thrown if the value transformer configuration contains invalid transformers.JSONException
- thrown if the value transformer configuration is no valid JSON.
-
-
Method Details
-
transformValue
The method applies the configured value transformer to the given value.- Parameters:
path
- the XML path to store the valuevalue
- the value to transform- Returns:
- the transformed value
-