You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2007/10/31 15:02:53 UTC

Sling API: RequestPathInfo

Hi all,

The RequestPathInfo interface is currently defined to return empty
strings (or empty array for one method) if no extension, selectors,
suffix exists in the request URL. This makes checking for existence of
any of the parts somewhat complicated. On the other hand to build a
string, you just print the respective method result and don't worry for
null values.

I would like to quickly poll on the list, what the general impression is
on the question: Should null or an empty instance (String, array) be
returned in the absence of the respective path part ?

My opinion is: null should be returned.

Regards
Felix


Re: Sling API: RequestPathInfo

Posted by Marcel Reutegger <ma...@day.com>.
Felix Meschberger wrote:
> The RequestPathInfo interface is currently defined to return empty
> strings (or empty array for one method) if no extension, selectors,
> suffix exists in the request URL. This makes checking for existence of
> any of the parts somewhat complicated. On the other hand to build a
> string, you just print the respective method result and don't worry for
> null values.

an empty string for selectorString is probably ambiguous.

what's the selectorString for the following URI: /foo/bar..html  ?

I think this is the only case where it should return an empty string.

> I would like to quickly poll on the list, what the general impression is
> on the question: Should null or an empty instance (String, array) be
> returned in the absence of the respective path part ?

I'd return an empty array, and in all other cases null if a URI part is absent.

regards
  marcel

Re: Sling API: RequestPathInfo

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 10/31/07, Felix Meschberger <fm...@gmail.com> wrote:

> ...My opinion is: null should be returned...

Agreed, that's probably easier to use.

-Bertrand

Re: Sling API: RequestPathInfo

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> Hi all,
> 
> The RequestPathInfo interface is currently defined to return empty
> strings (or empty array for one method) if no extension, selectors,
> suffix exists in the request URL. This makes checking for existence of
> any of the parts somewhat complicated. On the other hand to build a
> string, you just print the respective method result and don't worry for
> null values.
> 
> I would like to quickly poll on the list, what the general impression is
> on the question: Should null or an empty instance (String, array) be
> returned in the absence of the respective path part ?
> 
> My opinion is: null should be returned.
> 
I'm definitly +1 for null for strings, I'm not sure if that's the best
thing for arrays though, there I would prefer an empty array - but if
I'm the only one, null is fine as well.

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org