[
https://issues.apache.org/jira/browse/SLING-6327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15695103#comment-15695103
]
Konrad Windszus edited comment on SLING-6327 at 11/25/16 7:35 AM:
------------------------------------------------------------------
Actually [~bdelacretaz] stated
{quote}
I think this should be symmetric: no change if comparing two absolute
resource types, but if at least one of them is relative make both
relative based on the search path.
Something like
{code}
public boolean Resource.isResourceType(String type) {
if(this.getResourceType().startsWith(SLASH) && type.startsWith(SLASH)) {
return type.equals(this.getResourceType());
} else {
return relativeType(this.getResourceType()).equals(relativeType(type));
}
{code}
{quote}
(http://www.mail-archive.com/[email protected]/msg62366.html).
[~jsedding] Do you think we should do it differently?
To be honest I'm neither very opposed to the idea nor strongly in favour of
relativizing resource types in case both are given as absolute paths. But I
tend to agree with Bertrand because that way it is less likely that we break
existing code.
was (Author: kwin):
Actually [~bdelacretaz] stated
{quote}
I think this should be symmetric: no change if comparing two absolute
resource types, but if at least one of them is relative make both
relative based on the search path.
Something like
{code}
public boolean Resource.isResourceType(String type) {
if(this.getResourceType().startsWith(SLASH) && type.startsWith(SLASH)) {
return type.equals(this.getResourceType());
} else {
return relativeType(this.getResourceType()).equals(relativeType(type));
}
{code}
{quote}
(http://www.mail-archive.com/[email protected]/msg62366.html).
[~jsedding] Do you think we should do it differently?
To be honest I'm neither very opposed to the idea nor strongly in favour of
relatizing resource types in case both are given as absolute paths.
> ResourceResolverImpl.isResourceType() should consider resource resolver's
> search path
> -------------------------------------------------------------------------------------
>
> Key: SLING-6327
> URL: https://issues.apache.org/jira/browse/SLING-6327
> Project: Sling
> Issue Type: Improvement
> Components: ResourceResolver
> Affects Versions: API 2.15.0, Resource Resolver 1.5.2
> Reporter: Konrad Windszus
> Assignee: Konrad Windszus
> Attachments: SLING-6327-v01.patch
>
>
> Currently the following two expressions return false
> {{ResourceResolverImpl.isResourceType(<Resource with
> resourceType="sling/some/type">, "/libs/sling/some/type"}}
> {{ResourceResolverImpl.isResourceType(<Resource with
> resourceType="/libs/sling/some/type">, "sling/some/type"}}
> Since it cannot always be influenced whether the given resource is absolute
> or relative (because both usually works from a rendering perspective when you
> talk about the current request's resource), both cases should actually return
> {{true}}.
> See also the related discussion at
> http://www.mail-archive.com/[email protected]/msg62351.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)