Klasse AbstractResourceCollector

java.lang.Object
org.apache.sling.servlets.resolver.internal.helper.AbstractResourceCollector
Bekannte direkte Unterklassen:
NamedScriptResourceCollector, ResourceCollector

public abstract class AbstractResourceCollector extends Object
The ResourceCollector class provides a single public method - getServlets(ResourceResolver,List<String>) - 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.
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected final String
     
    protected static final String
     
    protected static final String
     
    protected final String[]
     
    protected final String
     
    protected int
     
    protected final String
     
    protected final String
     
    protected boolean
     
  • Konstruktorübersicht

    Konstruktoren
    Modifizierer
    Konstruktor
    Beschreibung
    protected
    AbstractResourceCollector(String baseResourceType, String resourceType, String resourceSuperType, String extension, String[] executionPaths, boolean useResourceCaching)
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    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 a WeightedResource and adds it to the set of resources.
    static void
    clearCache(@NotNull org.apache.sling.api.resource.ResourceResolver resolver)
     
    boolean
     
    protected final @NotNull org.apache.sling.api.resource.Resource
    getResource(@NotNull org.apache.sling.api.resource.ResourceResolver resolver, @NotNull String path, boolean useCaching)
    Returns a resource for the given path.
    static @Nullable org.apache.sling.api.resource.Resource
    getResourceOrNull(@NotNull org.apache.sling.api.resource.ResourceResolver resolver, @NotNull String path, boolean useCaching)
    Resolvers a resource or null if there is no resource resolved from the given path.
    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)
     
    int
     
    protected boolean
    Helper method to compare two strings which can possibly be null

    Von Klasse geerbte Methoden java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • CACHE_KEY_CHILDREN_LIST

      protected static final String CACHE_KEY_CHILDREN_LIST
    • CACHE_KEY_RESOURCES

      protected static final String CACHE_KEY_RESOURCES
    • 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
    • useResourceCaching

      protected boolean useResourceCaching
  • Konstruktordetails

    • AbstractResourceCollector

      protected AbstractResourceCollector(String baseResourceType, String resourceType, String resourceSuperType, String extension, String[] executionPaths, boolean useResourceCaching)
  • Methodendetails

    • 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 a 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.
      Parameter:
      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.
    • getResource

      @NotNull protected final @NotNull org.apache.sling.api.resource.Resource getResource(@NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resolver, @NotNull @NotNull String path, boolean useCaching)
      Returns a resource for the given path. If no resource exists at the given path a SyntheticResource is returned.
      Parameter:
      resolver - The ResourceResolver used to access the resource.
      path - The absolute path of the resource to return.
      Gibt zurück:
      The actual resource at the given path or a synthetic resource representing the path location.
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • stringEquals

      protected boolean stringEquals(String s1, String s2)
      Helper method to compare two strings which can possibly be null
    • clearCache

      public static void clearCache(@NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resolver)
    • getResourceOrNull

      @Nullable public static @Nullable org.apache.sling.api.resource.Resource getResourceOrNull(@NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resolver, @NotNull @NotNull String path, boolean useCaching)
      Resolvers a resource or null if there is no resource resolved from the given path.
      Parameter:
      resolver - the resourceResolver to use
      path - the path to the resource
      useCaching - indicates if caching should be used
      Gibt zurück:
      a resource or null if no resource can be resolved