Highlighted

When to use JCRUtility vs. ResourceResolverFactory for ResourceResolver

anthonyk3390753

01-04-2018

Hi,

We are writing a Listener to handle the Publish event, we see that we can use JCRUtility.getResourceResolver() or use resourceResolverFactory.getResourceResolver(paramMap).

How do we decide under what scenarios one is better or appropriate than the other.

Thanks.

Replies

Highlighted

smacdonald2008

01-04-2018

The best way to work with the JCR is to create a system user and then use this code to get a Session:

resourceResolverFactory.getResourceResolver(paramMap)

Highlighted

smacdonald2008

01-04-2018

For those reading this thread and want more detail on creating a system user and the Sling Mapping Server to use resourceResolverFactory.getResourceResolver(paramMap) - see this article -- Adobe Experience Manager Help | Querying Adobe Experience Manager 6 data using the Sling getServiceR...