Class StarResource

All Implemented Interfaces:
Adaptable, Resource

@Adaptable(adaptableClass=Resource.class, adapters=@Adapter(java.lang.String.class)) public class StarResource extends SyntheticResource
Used to provide the equivalent of an empty Node for GET requests to *.something (SLING-344)
  • Field Details

  • Constructor Details

  • Method Details

    • appliesTo

      public static boolean appliesTo(String path)
      True if a StarResource should be used for the given request, if a real Resource was not found
      Parameters:
      path - the path
      Returns:
      true if the StarResource should be used, false otherwise
    • isStarResource

      public static boolean isStarResource(Resource res)
      Returns true if the path of the resource ends with the SLASH_STAR and therefore should be considered a star resource.
      Parameters:
      res - the resource
      Returns:
      true if the StarResource should be used, false otherwise
    • getResourceSuperType

      public String getResourceSuperType()
      Calls ResourceUtil.getResourceSuperType(ResourceResolver, String) method to dynamically resolve the resource super type of this star resource.
      Specified by:
      getResourceSuperType in interface Resource
      Overrides:
      getResourceSuperType in class SyntheticResource
      Returns:
      the resource supertype
    • adaptTo

      public <Type> Type adaptTo(Class<Type> type)
      Description copied from class: SlingAdaptable
      Calls into the registered AdapterManager to adapt this object to the desired type.

      This method implements a cache of adapters to improve performance. That is repeated calls to this method with the same class will result in the same object to be returned.

      Specified by:
      adaptTo in interface Adaptable
      Overrides:
      adaptTo in class SlingAdaptable
      Type Parameters:
      Type - The generic type to which this resource is adapted to
      Parameters:
      type - The Class object of the target type, such as javax.jcr.Node.class or java.io.File.class
      Returns:
      The adapter target or null if the resource cannot adapt to the requested type