Interface ResourceResolverHelper
-
@Deprecated @ProviderType public interface ResourceResolverHelperDeprecated.TheResourceResolverHelperservice provides access to aResourceResolverpreviously provided for the current thread.The implementation provides two contexts:
- While handling a Servlet API request the default
ResourceResolverprovided 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> TypecallWith(ResourceResolver resolver, java.util.concurrent.Callable<Type> callable)Deprecated.Calls the givencallableunder the providesResourceResolver.ResourceResolvergetResourceResolver()Deprecated.Returns the currentResourceResolverfor the current thread ornullif 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> TypegetResourceResolverAs(java.lang.Class<Type> type)Deprecated.Returns the currentResourceResolveradapted to the selected type.
-
-
-
Method Detail
-
getResourceResolver
ResourceResolver getResourceResolver()
Deprecated.Returns the currentResourceResolverfor the current thread ornullif 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.ResourceResolverinstances must not be shared accross threads because they are not thread safe.
-
getResourceResolverAs
<Type> Type getResourceResolverAs(java.lang.Class<Type> type)
Deprecated.Returns the currentResourceResolveradapted to the selected type. If there is no currenResourceResolveror if theResourceResolverdoes not adapt to the desired typenullis returned.This method is equivalent to calling
getResourceResolver().adaptTo(type).- Parameters:
type- The type to which the currentResourceResolvershould be adapted.- Returns:
- The
ResourceResolveradapted to the desiredtypeornull
-
callWith
<Type> Type callWith(ResourceResolver resolver, java.util.concurrent.Callable<Type> callable) throws java.lang.Exception
Deprecated.Calls the givencallableunder the providesResourceResolver. Before calling thecallabletheresolveris set as the currentResourceResolversuch that thegetResourceResolver()method returns the givenResourceResolver.- Parameters:
resolver- TheResourceResolverto set as the currentResourceResolverbefore calling thecallable.callable- The code to execute under theresolver.- Returns:
- The result from calling the
callable - Throws:
java.lang.NullPointerException- ifcallableisnull.java.lang.Exception- The exception thrown by thecallableis returned.
-
-