Class MergingServletResourceProvider

java.lang.Object
org.apache.sling.spi.resource.provider.ResourceProvider<Object>
org.apache.sling.servlets.resolver.internal.resource.MergingServletResourceProvider

public class MergingServletResourceProvider extends ResourceProvider<Object>
  • Constructor Details

    • MergingServletResourceProvider

      public MergingServletResourceProvider()
  • Method Details

    • isRootOf

      public boolean isRootOf(String path)
    • getResource

      @Nullable public @Nullable Resource getResource(@NotNull @NotNull ResolveContext<Object> resolveContext, @NotNull @NotNull String s, @NotNull @NotNull ResourceContext resourceContext, @Nullable @Nullable Resource resource)
      Description copied from class: ResourceProvider
      Returns a resource from this resource provider or null if the resource provider cannot find it. The path must have the ResourceProvider.PROPERTY_ROOT strings as its prefix. The resource provider must not return cached instances for a resource as the resource resolver will update the resource meta data of the resource at the end of the resolution process and this meta data might be different depending on the full path of resource resolution passed into the resource resolver.
      Specified by:
      getResource in class ResourceProvider<Object>
      Parameters:
      resolveContext - The ResolveContext.
      s - The full path of the resource.
      resourceContext - Additional information for resolving the resource
      resource - Optional parent resource
      Returns:
      null If this provider does not have a resource for the path.
    • getResource

      public Resource getResource(ResolveContext resolveContext, String path)
    • listChildren

      public Iterator<Resource> listChildren(ResolveContext ctx, Resource parent)
      Description copied from class: ResourceProvider
      Returns an Iterator of Resource objects loaded from the children of the given Resource. The returned Resource instances are attached to the same ResourceResolver as the given parent resource.

      This method may be called for resource providers whose root path list contains a path such that the resource path is a prefix of the list entry. This allows for the enumeration of deeply nested provided resources for which no actual parent hierarchy exists.

      The returned iterator may in turn contain resources which do not actually exist but are required to traverse the resource tree. Such resources SHOULD be SyntheticResource objects whose resource type MUST be set to ResourceProvider.RESOURCE_TYPE_SYNTHETIC. As with ResourceProvider.getResource(ResolveContext, String, ResourceContext, Resource) the returned Resource objects must not be cached objects.

      Specified by:
      listChildren in class ResourceProvider<Object>
      Parameters:
      ctx - The ResolveContext.
      parent - The Resource whose children are requested.
      Returns:
      An Iterator of Resource objects or null if the resource provider has no children for the given resource.