[ 
https://issues.apache.org/jira/browse/SLING-2526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402536#comment-13402536
 ] 

sam commented on SLING-2526:
----------------------------

Probably this needs to be aware of resource type hierarchy.
For example,
@Properties({
    @Property(name = ResourceDecorator.PROPERTY_RESOURCE_TYPES, 
value={"old/handler1", "old/handler2"}),
    @Property(name = ResourceDecorator.PROPERTY_ALSO_FOR_CHILDREN, value=true)
}) 

will make MyResourceDecorator decorate resources of type old/handler1, 
old/handler2,  and any sub type of those. 


                
> 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