Interface ResourceResolverHelper
-
@Deprecated @ProviderType public interface ResourceResolverHelper
Deprecated.TheResourceResolverHelper
service provides access to aResourceResolver
previously provided for the current thread.The implementation provides two contexts:
- While handling a Servlet API request the default
ResourceResolver
provided is the one provided by the Sling Engine through theSlingHttpServletRequest
- In a callstack opened by a call to the
callWith(ResourceResolver, Callable)
method
- While handling a Servlet API request the default
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <Type> Type
callWith(ResourceResolver resolver, java.util.concurrent.Callable<Type> callable)
Deprecated.Calls the givencallable
under the providesResourceResolver
.ResourceResolver
getResourceResolver()
Deprecated.Returns the currentResourceResolver
for the current thread ornull
if this method is called on a thread which is not handling a request or which is not in a call stack started with a call to thecallWith(ResourceResolver, Callable)
method.<Type> Type
getResourceResolverAs(java.lang.Class<Type> type)
Deprecated.Returns the currentResourceResolver
adapted to the selected type.
-
-
-
Method Detail
-
getResourceResolver
ResourceResolver getResourceResolver()
Deprecated.Returns the currentResourceResolver
for the current thread ornull
if this method is called on a thread which is not handling a request or which is not in a call stack started with a call to thecallWith(ResourceResolver, Callable)
method.ResourceResolver
instances must not be shared accross threads because they are not thread safe.
-
getResourceResolverAs
<Type> Type getResourceResolverAs(java.lang.Class<Type> type)
Deprecated.Returns the currentResourceResolver
adapted to the selected type. If there is no currenResourceResolver
or if theResourceResolver
does not adapt to the desired typenull
is returned.This method is equivalent to calling
getResourceResolver().adaptTo(type)
.- Parameters:
type
- The type to which the currentResourceResolver
should be adapted.- Returns:
- The
ResourceResolver
adapted to the desiredtype
ornull
-
callWith
<Type> Type callWith(ResourceResolver resolver, java.util.concurrent.Callable<Type> callable) throws java.lang.Exception
Deprecated.Calls the givencallable
under the providesResourceResolver
. Before calling thecallable
theresolver
is set as the currentResourceResolver
such that thegetResourceResolver()
method returns the givenResourceResolver
.- Parameters:
resolver
- TheResourceResolver
to set as the currentResourceResolver
before calling thecallable
.callable
- The code to execute under theresolver
.- Returns:
- The result from calling the
callable
- Throws:
java.lang.NullPointerException
- ifcallable
isnull
.java.lang.Exception
- The exception thrown by thecallable
is returned.
-
-