Expand my Community achievements bar.

SOLVED

ThreadResourceResolver - is it safe to use and what are its limits?

Avatar

Level 1

We are currently using a ServiceResourceResolver which works fine, but noticed that the ThreadResourceResolver allows me to read from the JCR without issue - but I've not found documentation around its limits/permissions/etc, only that it's the last unclosed ResourceResolver created on the current thread.

  • Is it always non-null and able to read from the JCR? 
  • What are the assumed permissions?
  • Can it be used to write to the JCR?
1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

I assume you are referring to https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/granite/resourceresolverhelper/.... If so, this really only works in a request context in which case it will be the ResourceResolver associated with the current request.

So:

1) Yes it will always be non-null in a request context.

2) The permissions of the current user.

3) Depends upon the permissions of the current user.

Regards,

Justin

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

Hi,

I assume you are referring to https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/granite/resourceresolverhelper/.... If so, this really only works in a request context in which case it will be the ResourceResolver associated with the current request.

So:

1) Yes it will always be non-null in a request context.

2) The permissions of the current user.

3) Depends upon the permissions of the current user.

Regards,

Justin

Avatar

Level 1

I was referring to https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolverFactory.html#g... but would probably be a safe bet that your answer is correct for this one as well.

Thanks,

Joshua