To get a ResourceResolver without credentials (which is really what you
need), you have to use
ResourceResolverFactory.getAdministrativeResourceResolver().

Ideally, you would have support for a "resourceUser" which could be used
to grant access only to certain resources. Look at how the scriptUser
configuration parameter is implemented in SlingServletResolver. However,
without any context (i.e. the request), I'm not sure how you can
implement the "resolve the script resource from the request workspace"
logic in SlingServletResolver.

The other option (which I know some people won't like) is to store the
ResourceResolver in a ThreadLocal in the script engine.

Justin


On 9/3/10 11:01 AM, Mike Müller wrote:
> Hi
> 
> To resolve SLING-1708 [1] I would like to implement a
> Velocity ResourceManager which does not only get a template
> from the JCR but searches in the whole resource tree instead.
> So I wondered which is the easiest way to get a resource
> without a request.
> I guess I should get a ResourceResolver an call getResource(String)
> on it, but how do I get the correct ResourceResolver without a
> request?
> Can someone give me a pointer?
> 
> 
> [1] https://issues.apache.org/jira/browse/SLING-1708
> 
> best regards
> mike

Reply via email to