Developer
Jahia 8.2
Difference between Jahia and Jackrabbit session?
Question
Many pages in the tools propose to switch to a Jackrabbit/JCR session? What is it? How can I use it in a Groovy script?
Answer
Jahia has implemented different sessions to extend the Jackrabbit session. For example:
- JahiaSessionImpl: https://github.com/Jahia/jahia/blob/JAHIA_8_2_1_0/core/src/main/java/org/apache/jackrabbit/core/JahiaSessionImpl.java
- ExternalSessionImpl: https://github.com/Jahia/external-provider/blob/4_9_0/core/src/main/java/org/jahia/modules/external/ExternalSessionImpl.java
Consequently, switching to a "pure" Jackrabbit session will bypass some of the features implemented by Jahia. For example, you can find this option in:
- JCR repository browser: JAHIA_URL/modules/tools/jcrBrowser.jsp
- JCR Query Tool: JAHIA_URL/modules/tools/jcrQuery.jsp
If you don't switch, you'll be using a "Jahia" session.
If you want to do it in a Groovy script, here is the way to do it:
Session jrSession = jcrSession.getProviderSession(JCRSessionFactory.getInstance().getProvider("/"));