org.apache.sling.servlets.resolver.internal.helper
Class ResourceCollector

java.lang.Object
  extended by org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
      extended by org.apache.sling.servlets.resolver.internal.helper.ResourceCollector

public class ResourceCollector
extends AbstractResourceCollector

The ResourceCollector class provides a single public method - AbstractResourceCollector.getServlets(ResourceResolver) - 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.


Field Summary
protected static 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 is Integer.MIN_VALUE).
 
Fields inherited from class org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
baseResourceType, executionPaths, extension, hashCode, resourceSuperType, resourceType, workspaceName
 
Constructor Summary
ResourceCollector(String methodName, String baseResourceType, Resource resource, String workspaceName, String[] executionPaths)
          Creates a ResourceCollector finding servlets and scripts for the given methodName.
 
Method Summary
static ResourceCollector create(SlingHttpServletRequest request, String workspaceName, String[] executionPaths)
          Creates a ResourceCollector for the given request.
 boolean equals(Object obj)
           
protected  void getWeightedResources(Set<Resource> resources, Resource location)
           
 
Methods inherited from class org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
addWeightedResource, getResource, getServlets, hashCode, isPathAllowed, isPathAllowed, stringEquals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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 is Integer.MIN_VALUE).

See Also:
Constant Field Values
Constructor Detail

ResourceCollector

public ResourceCollector(String methodName,
                         String baseResourceType,
                         Resource resource,
                         String workspaceName,
                         String[] executionPaths)
Creates a ResourceCollector finding servlets and scripts for the given methodName.

Parameters:
methodName - The methodName used to find scripts for. This must not be null.
baseResourceType - The basic resource type to use as a final resource super type. If this is null the default value ServletResolverConstants.DEFAULT_SERVLET_NAME is assumed.
resource - the resource to invoke, the resource type and resource super type are taken from this resource.
Method Detail

create

public static ResourceCollector create(SlingHttpServletRequest request,
                                       String workspaceName,
                                       String[] executionPaths)
Creates a ResourceCollector for the given request. 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 - The SlingHttpServletRequest for which to return a ResourceCollector.
workspaceName -
Returns:
The ResourceCollector to find servlets and scripts suitable for handling the request.

getWeightedResources

protected void getWeightedResources(Set<Resource> resources,
                                    Resource location)
Specified by:
getWeightedResources in class AbstractResourceCollector

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractResourceCollector


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.