Package org.apache.sling.api.resource
Interface ResourceDecorator
-
@ConsumerType public interface ResourceDecorator
Optional service to decorateResource
s returned by theResourceResolver
. Typical use cases for a decorator are - overwrite resource type/resource super type (for example based on the resource path) - add metadata- Since:
- 2.1 (Sling API Bundle 2.1.0)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description @Nullable Resource
decorate(@NotNull Resource resource)
Decorate a resource.@Nullable Resource
decorate(@NotNull Resource resource, @NotNull HttpServletRequest request)
Deprecated.since 2.3.0 (and JCR Resource 2.1.0), this method will not be invoked.
-
-
-
Method Detail
-
decorate
@Nullable @Nullable Resource decorate(@NotNull @NotNull Resource resource)
Decorate a resource. If the service decorates the resource it should return the new resource. If the service does not want to decorate the resource, it should return the original resource. Returningnull
is considered the same as returning the original resource.- Parameters:
resource
- The resource to decorate- Returns:
- The decorated resource, the original resource or null.
-
decorate
@Deprecated @Nullable @Nullable Resource decorate(@NotNull @NotNull Resource resource, @NotNull @NotNull HttpServletRequest request)
Deprecated.since 2.3.0 (and JCR Resource 2.1.0), this method will not be invoked.Decorate a resource. If the service decorates the resource it should return the new resource. If the service does not want to decorate the resource, it should return the original resource. Returningnull
is considered the same as returning the original resource.- Parameters:
resource
- The resource to decoraterequest
- The current request.- Returns:
- The decorated resource, the original resource or null.
-
-