April 3, 2020
Estimated Post Reading Time ~

Get Resource Resolver from session CQ5/AEM

Oddly, it is easy enough to get a resourceResolver from the session. // Below, is how you can do it.

public ResourceResolver getResourceResolverFromSession(final Session session, final ResourceResolverFactory resourceResolverFactory) {

try {
return resourceResolverFactory.getResourceResolver(Collections.singletonMap(“user.jcr.session”, (Object) session));
} catch (LoginException e) {
throw new IllegalStateException(e);
}
}



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.