Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
The API changed significantly in Magnolia 4.5. The old CMS and CMS Utility tag libraries were also dropped. New
stkfn templating support objects replace them. See Templating Proposal for example usage. The old JSP tags are in a JSP Templating module in case you need them.
These are the essential interfaces and classes in the Magnolia API. See also full API Javadoc.
Context is an abstraction layer representing the environment of the current process which can be a request process, a scheduled task or a command execution in the workflow. The context provides access to the most important components such as hierarchy managers, current user, context attributes and parameters, response object and so on. The context is initialized at the beginning of each process. Context attributes will have a different meaning based on the environment. In case of a request, the attributes are request attributes and request parameters. Magnolia implements context using a thread-local class.
getInstance()Returns the current context.
getUser()Returns the current user.
getJCRSession(String workspacename). Returns a JCR session to the provided workspace.
getAttribute(name)Returns a named context attribute. In case of a request, this can be a request parameter, request attribute or session attribute.
getWebContext()Returns the Web context if the current thread is processing a request.
getRequest()Returns the current servlet request object.
getResponse()Returns the current servlet response object.
getOriginalURI()Original URI is the URI as requested by the client.
getCurrentURI()URI as mapped by Magnolia at a given point in processing. This value is for instance changed by the i18n filter, virtual URI mapping etc.
getMainContentNode()The content with which we start the rendering process. In general this is the page node.
getCurrentContentNode()The content that is processed at the moment. First this is typically the page, then a component and so on.
getNode(java.lang.String absPath). Returns the node at the specified absolute path in the workspace.
getNodeByIdentifier(java.lang.String id)Returns the node specified by the given identifier.
save(). Validates all pending changes currently recorded in this Session.
getNode(java.lang.String relPath). Returns the node at
relPathrelative to this node.
getNodes() Returns all child nodes of this node accessible through the current
getNodes(java.lang.String namePattern) Gets all child nodes of this node accessible through the current
Session that match
getProperty(java.lang.String relPath) Returns the property at relPath relative to this node.
setProperty(java.lang.String name, Value value) Sets the single-value property of this node called name to the specified value.
Propertyobject represents the smallest granularity of content storage.
isActivated(javax.jcr.Node node)Returns true if the node has been activated.
getCreated(javax.jcr.Node node)Returns the creation date of a node or null if creation date isn't set.
render(javax.jcr.Node content, OutputProvider out) Renders the content with its assigned template.
render(javax.jcr.Node content, RenderableDefinition definition, Map<String,Object> contextObjects, OutputProvider out) Uses a specific RenderableDefinition to render the content and exposes the given context objects to the template script.
getName()Name of the template definition.
getRenderType()Defines the renderer to use. For instance JSP or Freemarker.
RenderableDefinitionwhich supports editing in the page editor and can define their areas.
executemethod is executed before the rendering starts, a useful place to execute any business logic. The model is available in the template script under the named model.
getParent()Parent model. Most often the model of the page rendering.
getNode()The content node tied to this model.
getContent()Map representation of the content node tied to this model.
getDefinition() The renderable (template, area or component) tied to this model.
execute() Called after all properties were set.
render(RenderingContext ctx, Map<String,Object> contextObjects) Called by
RenderingEngine after it has setup the
content.<property name>. It first tries to read a property with name (key) and, if not present, checks for the presence of a child node. Special property names map to JCR methods:
getAsset(javax.jcr.Node content, String nodeDataPrefix)
getAssetLink(javax.jcr.Node content, String nodeDataPrefix, String variationName)
makePathRelative(String url, String absolutePath)