You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@gmail.com> on 2009/09/04 11:34:11 UTC

Computing the resource supertype (was: svn commit: r811295...)

Hi,

On Fri, Sep 4, 2009 at 11:03 AM, <fm...@apache.org> wrote:
> ...   sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/helpers/HtmlRendererServlet.java

> +        String resourceSuperType = r.getResourceSuperType();
> +        if (resourceSuperType == null) {
> +            resourceSuperType = ResourceUtil.getResourceSuperType(
> +                r.getResourceResolver(), r.getResourceType());
> +            if (resourceSuperType == null) {
> +                resourceSuperType = "sling/servlet/default (default resource super type)";
> +            } else {
> +                resourceSuperType += " (from resource type hierarchy)";
> +            }

If this is the way of finding a resource's supertype, shouldn't this
code be part of the ResourceUtil class?

I'd like to add the info to the RequestProgressTracker as well, and
duplicating that code does not feel right.

-Bertrand

Re: Computing the resource supertype (was: svn commit: r811295...)

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Bertrand Delacretaz schrieb:
> Hi,
> 
> On Fri, Sep 4, 2009 at 11:03 AM, <fm...@apache.org> wrote:
>> ...   sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/helpers/HtmlRendererServlet.java
> 
>> +        String resourceSuperType = r.getResourceSuperType();
>> +        if (resourceSuperType == null) {
>> +            resourceSuperType = ResourceUtil.getResourceSuperType(
>> +                r.getResourceResolver(), r.getResourceType());
>> +            if (resourceSuperType == null) {
>> +                resourceSuperType = "sling/servlet/default (default resource super type)";
>> +            } else {
>> +                resourceSuperType += " (from resource type hierarchy)";
>> +            }
> 
> If this is the way of finding a resource's supertype, shouldn't this
> code be part of the ResourceUtil class?
> 
> I'd like to add the info to the RequestProgressTracker as well, and
> duplicating that code does not feel right.

You are perfectly right, and I do not even know our API. There is a
ReousrceUtil.findResourceSuperType method which exactly does that ....
my bad.

Thanks for pointing this out.

Regards
Felix