You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Robert Munteanu <ro...@apache.org> on 2018/08/01 21:19:44 UTC

[api] SLING-7792 - Resource Resolver should return more than one resolved path if available

Hi,

To fix $SUBJECT I created a draft API change PR at

  https://github.com/apache/sling-org-apache-sling-api/pull/6

Would appreciate as many eyes on the changes as possible.

Thanks!

Robert


Re: [api] SLING-7792 - Resource Resolver should return more than one resolved path if available

Posted by Robert Munteanu <ro...@apache.org>.
On Fri, 2018-08-03 at 16:03 +0200, Carsten Ziegeler wrote:
> I tend to agree with Jason, getting different results based on a
> parameter is a little bit subtle.
> 
> Four methods are not nice either, but at least draw a clear picture
> 
> Regards
> 
> Carsten

I've updated the PR based on this feedback (and from the Jira issue).

Robert


Re: [api] SLING-7792 - Resource Resolver should return more than one resolved path if available

Posted by Carsten Ziegeler <cz...@apache.org>.
I tend to agree with Jason, getting different results based on a
parameter is a little bit subtle.

Four methods are not nice either, but at least draw a clear picture

Regards

Carsten


Robert Munteanu wrote
> On Fri, 2018-08-03 at 09:41 -0400, Jason E Bailey wrote:
>> IIUC the two new methods of getMapping and getAllMappings will return
>> either a path or a full URL depending on whether a HttpServletRequest
>> is being passed. That's overloading a function to return two
>> different things based on the existence of a parameter.
>>
>> In my experience a method should do one thing and I disagree with
>> that approach.
> 
> The reason for adding a nullable request parameter was to keep the API
> small - two methods instead of four. Indeed, that's debateable and I'm
> curious about what others think.
> 
> Robert
> 
-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: [api] SLING-7792 - Resource Resolver should return more than one resolved path if available

Posted by Robert Munteanu <ro...@apache.org>.
On Fri, 2018-08-03 at 09:41 -0400, Jason E Bailey wrote:
> IIUC the two new methods of getMapping and getAllMappings will return
> either a path or a full URL depending on whether a HttpServletRequest
> is being passed. That's overloading a function to return two
> different things based on the existence of a parameter.
> 
> In my experience a method should do one thing and I disagree with
> that approach.

The reason for adding a nullable request parameter was to keep the API
small - two methods instead of four. Indeed, that's debateable and I'm
curious about what others think.

Robert


Re: [api] SLING-7792 - Resource Resolver should return more than one resolved path if available

Posted by Jason E Bailey <je...@apache.org>.
IIUC the two new methods of getMapping and getAllMappings will return either a path or a full URL depending on whether a HttpServletRequest is being passed. That's overloading a function to return two different things based on the existence of a parameter.

In my experience a method should do one thing and I disagree with that approach.

- Jason

On Wed, Aug 1, 2018, at 5:19 PM, Robert Munteanu wrote:
> Hi,
> 
> To fix $SUBJECT I created a draft API change PR at
> 
>   https://github.com/apache/sling-org-apache-sling-api/pull/6
> 
> Would appreciate as many eyes on the changes as possible.
> 
> Thanks!
> 
> Robert
>