Package org.opencms.xml.xml2json.handler
Class CmsJsonHandlerXmlContent
java.lang.Object
org.opencms.xml.xml2json.handler.CmsJsonHandlerXmlContent
- All Implemented Interfaces:
I_CmsJsonHandler
- Direct Known Subclasses:
CmsJsonHandlerList
Sub-handler for converting XML contents to JSON, either as a whole or just specific locales or paths.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Exception thrown when path lookup fails. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic JSONObject
empty()
Creates an empty JSON object.double
getOrder()
Gets the sort order for this handler.boolean
matches
(CmsJsonHandlerContext context) Returns true if the handler matches the given context.renderJson
(CmsJsonHandlerContext context) Renders the JSON.renderJson
(CmsJsonHandlerContext context, boolean throwError) Renders a JSON representation of an XML content.
-
Field Details
-
PARAM_LOCALE
Request parameter name.- See Also:
-
PARAM_PATH
Request parameter name.- See Also:
-
-
Constructor Details
-
CmsJsonHandlerXmlContent
public CmsJsonHandlerXmlContent()
-
-
Method Details
-
empty
Creates an empty JSON object.- Returns:
- the empty JSON object
-
getOrder
Description copied from interface:I_CmsJsonHandler
Gets the sort order for this handler.Handlers are sorted by ascending order, and the first matching handler is selected.
- Specified by:
getOrder
in interfaceI_CmsJsonHandler
- Returns:
- the sort order
- See Also:
-
matches
Description copied from interface:I_CmsJsonHandler
Returns true if the handler matches the given context.- Specified by:
matches
in interfaceI_CmsJsonHandler
- Parameters:
context
- the context- Returns:
- true if the handler matches
- See Also:
-
renderJson
Description copied from interface:I_CmsJsonHandler
Renders the JSON.- Specified by:
renderJson
in interfaceI_CmsJsonHandler
- Parameters:
context
- the context (provides information about the path and resource)- Returns:
- the JSON result
- See Also:
-
renderJson
Renders a JSON representation of an XML content.- Parameters:
context
- the handler contextthrowError
- whether to throw an error if a locale or path selection fails- Returns:
- the XML content as JSON
-