org.apache.sling.api.resource
Interface ResourceDecorator


public interface ResourceDecorator

Optional service to decorate Resources returned by the ResourceResolver. 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

Method Summary
 Resource decorate(Resource resource)
          Decorate a resource.
 Resource decorate(Resource resource, javax.servlet.http.HttpServletRequest request)
          Decorate a resource.
 

Method Detail

decorate

Resource decorate(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. Returning null 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

Resource decorate(Resource resource,
                  javax.servlet.http.HttpServletRequest request)
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. Returning null is considered the same as returning the original resource.

Parameters:
resource - The resource to decorate
request - The current request.
Returns:
The decorated resource, the original resource or null.


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