public abstract class AbstractResourceCollector extends Object
ResourceCollector class provides a single public method -
#getServlets(ResourceResolver,List) - which is used to find an ordered collection
of Resource instances which may be used to find a servlet or
script to handle a request to the given resource.| Modifier and Type | Field and Description |
|---|---|
protected String |
baseResourceType |
protected String[] |
executionPaths |
protected String |
extension |
protected int |
hashCode |
protected String |
resourceSuperType |
protected String |
resourceType |
| Constructor and Description |
|---|
AbstractResourceCollector(String baseResourceType,
String resourceType,
String resourceSuperType,
String extension,
String[] executionPaths) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addWeightedResource(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources,
org.apache.sling.api.resource.Resource resource,
int numSelectors,
int methodPrefixWeight)
Creates a
WeightedResource and adds it to the set of resources. |
boolean |
equals(Object obj) |
protected org.apache.sling.api.resource.Resource |
getResource(org.apache.sling.api.resource.ResourceResolver resolver,
String path)
Returns a resource for the given
path. |
Collection<org.apache.sling.api.resource.Resource> |
getServlets(org.apache.sling.api.resource.ResourceResolver resolver,
List<String> scriptExtensions) |
protected abstract void |
getWeightedResources(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources,
org.apache.sling.api.resource.Resource location) |
int |
hashCode() |
protected boolean |
stringEquals(String s1,
String s2)
Helper method to compare two strings which can possibly be
null |
protected final String baseResourceType
protected final String extension
protected int hashCode
protected final String resourceType
protected final String resourceSuperType
protected final String[] executionPaths
public final Collection<org.apache.sling.api.resource.Resource> getServlets(org.apache.sling.api.resource.ResourceResolver resolver, List<String> scriptExtensions)
protected abstract void getWeightedResources(Set<org.apache.sling.servlets.resolver.internal.helper.WeightedResource> resources, org.apache.sling.api.resource.Resource location)
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)
WeightedResource and 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.resources - The set of resource to which the
WeightedResource is added.resource - The Resource on which the
WeightedResource is 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.protected final org.apache.sling.api.resource.Resource getResource(org.apache.sling.api.resource.ResourceResolver resolver,
String path)
path.
If no resource exists at the given path a
SyntheticResource is returned.resolver - The ResourceResolver used to access the
resource.path - The absolute path of the resource to return.path or a
synthetic resource representing the path location.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.