Class AbstractResourceCollector
- java.lang.Object
-
- org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
-
- Direct Known Subclasses:
NamedScriptResourceCollector,ResourceCollector
public abstract class AbstractResourceCollector extends Object
TheResourceCollectorclass provides a single public method -#getServlets(ResourceResolver,List- which is used to find an ordered collection of) Resourceinstances 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 StringbaseResourceTypeprotected String[]executionPathsprotected Stringextensionprotected inthashCodeprotected StringresourceSuperTypeprotected StringresourceType
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddWeightedResource(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource resource, int numSelectors, int methodPrefixWeight)Creates aWeightedResourceand adds it to the set of resources.booleanequals(Object obj)protected org.apache.sling.api.resource.ResourcegetResource(org.apache.sling.api.resource.ResourceResolver resolver, String path)Returns a resource for the givenpath.Collection<org.apache.sling.api.resource.Resource>getServlets(org.apache.sling.api.resource.ResourceResolver resolver, List<String> scriptExtensions)protected abstract voidgetWeightedResources(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource location)inthashCode()protected booleanstringEquals(String s1, String s2)Helper method to compare two strings which can possibly benull
-
-
-
Field Detail
-
baseResourceType
protected final String baseResourceType
-
extension
protected final String extension
-
hashCode
protected int hashCode
-
resourceType
protected final String resourceType
-
resourceSuperType
protected final String resourceSuperType
-
executionPaths
protected final String[] executionPaths
-
-
Method Detail
-
getServlets
public final Collection<org.apache.sling.api.resource.Resource> getServlets(org.apache.sling.api.resource.ResourceResolver resolver, List<String> scriptExtensions)
-
getWeightedResources
protected abstract void getWeightedResources(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource location)
-
addWeightedResource
protected final void addWeightedResource(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource resource, int numSelectors, int methodPrefixWeight)
Creates aWeightedResourceand adds it to the set of resources. The number of resources already present in the set is used as the ordinal number for the newly created resource.- Parameters:
resources- The set of resource to which theWeightedResourceis added.resource- TheResourceon which theWeightedResourceis based.numSelectors- The number of request selectors which are matched by the name of the resource.methodPrefixWeight- The method/prefix weight assigned to the resource according to the resource name.
-
getResource
protected final org.apache.sling.api.resource.Resource getResource(org.apache.sling.api.resource.ResourceResolver resolver, String path)Returns a resource for the givenpath. If no resource exists at the given path aSyntheticResourceis returned.- Parameters:
resolver- TheResourceResolverused to access the resource.path- The absolute path of the resource to return.- Returns:
- The actual resource at the given
pathor a synthetic resource representing the path location.
-
-