sam created SLING-2526:
--------------------------

             Summary: register ResourceDecorator for specific resourceType(s)
                 Key: SLING-2526
                 URL: https://issues.apache.org/jira/browse/SLING-2526
             Project: Sling
          Issue Type: Improvement
          Components: ResourceResolver
            Reporter: sam
            Priority: Minor


Currently, I can only change resourceType of resources globally using 
ResourceDecorator:
=8<=
    @Override
    public Resource decorate(Resource resource, HttpServletRequest request) {
        final String resourceType = resource.getResourceType();
        if ("old/handler".equals(resourceType)) {
            return new ResourceWrapper(resource) {
                @Override
                public String getResourceType() {
                    return "new/handler";
                }
            };
        }
        return resource;
    }

=>8=

It'd be nice if I could register my ResourceDecorator service to certain 
resourceType(s)  so that I can eliminate if conditional. 

Something like:

@Properties({
    @Property(name = SlingConstants.PROPERTY_RESOURCE_TYPES, 
value={"old/handler1", "old/handler2"})
})
public class MyResourceDecorator implements ResourceDecorator {
...

And, MyResourceDecorator will only decorate resources of type  old/handler1  
and old/handler2.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to