This article covers a Bloomreach Experience Manager version 11. There's an updated version available that covers our most recent release.

Retrieving a pooled session

In general*, HST request processing is done with a liveuser JCR session from the liveuser session pool, or, in case of the preview in the channel manager, with a user which has the joint read-access of a previewuser session plus the currently logged in cms user session, see Security Delegation.

*For a site that requires authenticated and is marked with hst:subjectbasedsession = true, a session specific for the authenticated user is used instead of a pooled JCR session.

For a normal live site rendering request, invoking  HstRequestContext#getSession(), returns a pooled liveuser session. For an action request (HTTP POST), it depends whether the doAction method is annotated with @Persistable or not, see  HstComponent Persistable annotation and workflow. If you need a different pooled JCR session than the default one returned by   HstRequestContext#getSession(), for example because you need read access to the HST configuration nodes, you can achieve this through the HST Spring ComponentManager as follows:

Getting a pooled JCR Session 

Repository repository = HstServices
               .getComponentManager()
               .getComponent(Repository.class.getName());
Session mySession = repository.login(credentials);

JCR Sessions, retrieved through the component manager as explained above, are managed by HST session pools. Developers do not need to take care of logging them out. This is not the case for non-pooled sessions: A developer is required to logout such sessions himself.

Getting credentials for pooled users

The above code returns a pooled session, however, you need to get hold of the credentials for pooled users. There are 5 default available Session pools (see HST users) in HST, for which you can retrieve the credentials as follows:

ComponentManager mngr = HstServices.getComponentManager();
Credentials configCred = mngr.getComponent(Credentials.class.getName() + ".hstconfigreader");
Credentials liveCred = mngr.getComponent(Credentials.class.getName() + ".default");
Credentials binariesCred = mngr.getComponent(Credentials.class.getName() + ".binaries");
Credentials previewCred = mngr.getComponent(Credentials.class.getName() + ".preview");
Credentials writeCred = mngr.getComponent(Credentials.class.getName() + ".writable");

 

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?