Class ResourceCollector
- java.lang.Object
-
- org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
-
- org.apache.sling.servlets.resolver.internal.helper.ResourceCollector
-
public class ResourceCollector extends AbstractResourceCollector
TheResourceCollectorclass provides a single public method -#getServlets(ResourceResolver)- which is used to find an ordered collection ofResourceinstances which may be used to find a servlet or script to handle a request to the given resource.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intWEIGHT_NO_MATCHThe special value returned by#calculatePrefixMethodWeight(Resource, String, boolean)if the resource is not suitable to handle the request according to the location prefix, request selectors and request extension (value isInteger.MIN_VALUE).-
Fields inherited from class org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
baseResourceType, CACHE_KEY_CHILDREN_LIST, CACHE_KEY_RESOURCES, executionPaths, extension, hashCode, resourceSuperType, resourceType, useResourceCaching
-
-
Constructor Summary
Constructors Constructor Description ResourceCollector(String methodName, String baseResourceType, org.apache.sling.api.resource.Resource resource, String[] executionPaths)Deprecated.use#ResourceCollector(String, String, Resource, String, String[])instead.ResourceCollector(String methodName, String baseResourceType, org.apache.sling.api.resource.Resource resource, String extension, String[] executionPaths, boolean useResourceCaching)Creates aResourceCollectorfinding servlets and scripts for the givenmethodName.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResourceCollectorcreate(org.apache.sling.api.resource.Resource resource, String extension, String[] executionPaths, String[] defaultExtensions, String methodName, String[] selectors, boolean useResourceCaching)static ResourceCollectorcreate(org.apache.sling.api.SlingHttpServletRequest request, String[] executionPaths, String[] defaultExtensions, boolean UseResourceCaching)Creates aResourceCollectorfor the givenrequest.booleanequals(Object obj)protected voidgetWeightedResources(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource location)inthashCode()-
Methods inherited from class org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
addWeightedResource, clearCache, getResource, getResourceOrNull, getServlets, stringEquals
-
-
-
-
Field Detail
-
WEIGHT_NO_MATCH
protected static final int WEIGHT_NO_MATCH
The special value returned by#calculatePrefixMethodWeight(Resource, String, boolean)if the resource is not suitable to handle the request according to the location prefix, request selectors and request extension (value isInteger.MIN_VALUE).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceCollector
@Deprecated public ResourceCollector(String methodName, String baseResourceType, org.apache.sling.api.resource.Resource resource, String[] executionPaths)
Deprecated.use#ResourceCollector(String, String, Resource, String, String[])instead.Creates aResourceCollectorfinding servlets and scripts for the givenmethodName.- Parameters:
methodName- ThemethodNameused to find scripts for. This must not benull.baseResourceType- The basic resource type to use as a final resource super type. If this isnullthe default valueorg.apache.sling.servlets.resolver.internal.ServletResolverConstants#DEFAULT_SERVLET_NAMEis assumed.resource- the resource to invoke, the resource type and resource super type are taken from this resource.executionPaths- the execution paths to consider
-
ResourceCollector
public ResourceCollector(String methodName, String baseResourceType, org.apache.sling.api.resource.Resource resource, String extension, String[] executionPaths, boolean useResourceCaching)
Creates aResourceCollectorfinding servlets and scripts for the givenmethodName.- Parameters:
methodName- ThemethodNameused to find scripts for. This must not benull.baseResourceType- The basic resource type to use as a final resource super type. If this isnullthe default valueorg.apache.sling.servlets.resolver.internal.ServletResolverConstants#DEFAULT_SERVLET_NAMEis assumed.resource- the resource to invoke, the resource type and resource super type are taken from this resource.extension- the extension of the request being processedexecutionPaths- the execution paths to consider
-
-
Method Detail
-
create
public static ResourceCollector create(org.apache.sling.api.SlingHttpServletRequest request, String[] executionPaths, String[] defaultExtensions, boolean UseResourceCaching)
Creates aResourceCollectorfor the givenrequest. If the request is a GET or HEAD request, a specialized instance is returned which also takes the request selectors and request extension into account for finding servlet resources. Otherwise an instance of this class itself is returned which just takes the resource type and request method name into account.- Parameters:
request- TheSlingHttpServletRequestfor which to return aResourceCollector.- Returns:
- The
ResourceCollectorto find servlets and scripts suitable for handling therequest.
-
create
public static ResourceCollector create(org.apache.sling.api.resource.Resource resource, String extension, String[] executionPaths, String[] defaultExtensions, String methodName, String[] selectors, boolean useResourceCaching)
-
getWeightedResources
protected void getWeightedResources(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource location)
- Specified by:
getWeightedResourcesin classAbstractResourceCollector
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractResourceCollector
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractResourceCollector
-
-