The SiteVision model can be accessed using the JSR 283 (Java Content Repository) standard. SiteVision currently supports level 1 of JCR, which means that it is a read-only interface where you can read but not alter data. Currently there are some restrictions to the present level 1 implementation (for more information about what is implemented and what is not see the javax.jcr classes in the SiteVision public API javadoc. Features that are not implemented are denoted 'Unsupported operation')
For fast and effective access SiteVision data you must have knowledge of the data model tree.
To access the data in the model just define your point of origin and extract the corresponding node from the Session or use the SiteVision specific utilities. With this node as base it is possible to traverse the model tree and retrieve information about nodes and their properties using node and property iterators.
SiteVision also exposes a supporting API for the JCR implementation in SiteVision that can make your life easier - especially if you use the JCR programming model from Velocity.
Please note that since the API is continuously updated, some methods and JCR properties are only available in the latest version of SiteVision. A tip if you need to do backward compatibility workarounds: you can get the SiteVision version via the system property "sitevision.version" (i.e. System.getProperty("sitevision.version")).
Always check the change log of the SiteVision Public API whenever you upgrade or a new SiteVision version is released.
The SiteVision Public API change log contains information about new fields/methods/interfaces/enums in the API and what's been fixed or deprecated.
SiteVision makes sure that the JCR session and the utilities are available as attributes in the portlet request at all times.
public class IndexAction extends DefaultActionSupport
public String execute()
ActionContext ctx = ActionContext.getContext();
PortletRequest req = (PortletRequest) ctx.get(
// Retrieve the JCR session
Session s = (Session) req.getAttribute(
// Retrieve the SiteVision utils
Utils u = (Utils) req.getAttribute(
The JCR session and the utilities are also available in all JCR capable SiteVision portlets that exposes a custom template (e.g. the Menu portlet).
## use the JCR session
## use the SiteVision utils
To be able to develop your own portlet that uses the public API, you will need access to the Public API jar-file. It is available in the maven repository (more information about the maven repository is available here).
The class loader hierarchy makes the jar-file available to your portlet when it is deployed in SiteVision. This means that your war-file must never contain this file!
In versions prior to SiteVision 2.6_02 the public api jar was split in two jars (jcr-2.0-public-review.jar and sitevision-api-<version>.jar)!
Missa inga nya rön, tips och tricks! Prenumerera på insite!