Package org.opencms.xml.xml2json.handler
Class CmsJsonHandlerContext
java.lang.Object
org.opencms.xml.xml2json.handler.CmsJsonHandlerContext
Provides context information to JSON handlers.
Also lazily loads the resource or content to be rendered as JSON.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Cache key for JSON handler contexts. -
Constructor Summary
ConstructorDescriptionCmsJsonHandlerContext
(CmsObject cms, CmsObject rootCms, String path, CmsResource resource, Map<String, String> params, CmsParameterConfiguration handlerConfig, CmsJsonAccessPolicy policy) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the access policy.getCms()
Gets the CMS context.Loads the XML content.getFile()
Gets the file for the path.Gets the configured handler parameters.getKey()
Creates a cache key for this context.Gets the request parameters.getPath()
Returns the path.Gets the resource (may be null if there is no resource).Gets the CMS context initialized to the root site.Gets the temporary storage to be used by individual handlers.
-
Constructor Details
-
CmsJsonHandlerContext
public CmsJsonHandlerContext(CmsObject cms, CmsObject rootCms, String path, CmsResource resource, Map<String, String> params, CmsParameterConfiguration handlerConfig, CmsJsonAccessPolicy policy) Creates a new instance.- Parameters:
cms
- the CMS contextrootCms
- the CMS context initialized for the root sitepath
- the path below the JSON handlerresource
- the resource (may be null)params
- the request parametershandlerConfig
- the handler parameters from opencms-system.xmlpolicy
- the access policy
-
-
Method Details
-
getAccessPolicy
Gets the access policy.- Returns:
- the access policy
-
getCms
Gets the CMS context.- Returns:
- the CMS context
-
getContent
Loads the XML content.This only works if the resource for the given path is actually an XML content.
- Returns:
- the XML content for the path
- Throws:
CmsException
- if something goes wrong
-
getFile
Gets the file for the path. This will only work if the resource for the path is actually a file.- Returns:
- the file for the path
- Throws:
CmsException
- if something goes wrong
-
getHandlerConfig
Gets the configured handler parameters.- Returns:
- the configured handler parameters
-
getKey
Creates a cache key for this context.- Returns:
- the cache key
-
getParameters
Gets the request parameters.- Returns:
- the request parameters
-
getPath
Returns the path.- Returns:
- the path
-
getResource
Gets the resource (may be null if there is no resource).- Returns:
- the resource
-
getRootCms
Gets the CMS context initialized to the root site.- Returns:
- the CMS context initialized to the root site
-
getTempStorage
Gets the temporary storage to be used by individual handlers.- Returns:
- the temporary storage
-