April 3, 2020
Estimated Post Reading Time ~ < 1 Min

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);
}
}

aem4beginner.blogspot


By aem4beginner

No comments:

Post a Comment

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

Ad Blocker Detected :(

Please consider supporting us by disabling your ad blocker.

Please Disable your adblocker and Refresh the page to view the site content.