AEM 6.4 - Not able to access resource with below resourceResolver
This issue is related to get a resource with the help of system user ("someuser") having all permissions given to that user in AEM 6.4. below is the code snippet:
In configuration, my system user is defined as "someuser" against the bundle. But, for below code I am doing resourceResolver.get UserId() giving me //sling-scripting. It should give me "someuser".
ResourceResolverFactory resourceResolverFactory = sling.getService(ResourceResolverFactory.class);
ResourceResolver systemResourceResolver = resourceResolver;
if (!(resourceResolverFactory == null)) {
Map<String, Object> authenticationInfo = new HashMap<>();
authenticationInfo.put(ResourceResolverFactory.SUBSERVICE, "bundlevalidation");
systemResourceResolver = resourceResolverFactory.getServiceResourceResolver(authenticationInfo);
}
String pagePath = slingRequest.getRequestPathInfo().getSuffix();
Resource contentBundleResource = null;
if (pagePath != null) {
Resource res = systemResourceResolver.getResource(validPagePath);
}
I debugged all variables above defined, only res is coming as null.
This code is working fine in AEM 6.1. But creating issue in 6.4.
What code change do I need to make for getting that resource.
I studied below link but didn't get much information:
AEM 6.4 unable to access content path via resourceresolver/session
Also, I have this code written in JSP file.
Thanks in advance.