ThreadResourceResolver - is it safe to use and what are its limits? | Community
Skip to main content
December 7, 2015
Solved

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

  • December 7, 2015
  • 2 replies
  • 1858 views

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?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

Hi,

I assume you are referring to https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/granite/resourceresolverhelper/ResourceResolverHelper.html. 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

2 replies

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
December 7, 2015

Hi,

I assume you are referring to https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/granite/resourceresolverhelper/ResourceResolverHelper.html. 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

December 7, 2015

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

Thanks,

Joshua