On 6 Jul 2015 at 18:38:02, vincent(a)massol.net
(vincent@massol.net(mailto:vincent@massol.net)) wrote:
On 6 Jul 2015 at 18:14:07, Guillaume Louis-Marie Delhumeau
(gdelhumeau@xwiki.com(mailto:gdelhumeau@xwiki.com)) wrote:
Thomas actually convinced me that 2) is better.
It’s certainly “better” for the implementer since it’s simpler to implement.
Forget that sentence. I was tired yesterday and mixed up things apparently :)
-Vincent
In the end it’s really a question of:
1) shorter URLs or not (since escaping “pages” is not really a big deal - FTR I had
replied to you at
http://jira.xwiki.org/browse/XWIKI-12206?focusedCommentId=87131&page=co…)131).
2) Whether we want to strictly consider each space as a REST entity or the list of spaces
itself as the REST entity, i.e. in the same way as our EntityReference in Java or not.
I think I agree that sol2 is the best (for now), even though I hate that it’s so long,
but it’s consistent.
Thanks
-Vincent
PS: Re 1) see
http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-u…
which says that if we want to be fine we should not go beyond 2000 chars in URLs (IE10 has
a 2083 limit for example - Incidentally this could also be a problem for the view action
for long hierarchies but your hierarchies would really need to be very long: with an
average of 20 chars per space level, you’d need an 80 -level deep hierarchy to reach the
problem - And a 40 level deep one for the REST URL). So we should be safe.
Why: how to access a space called
"pages"?
It would be:
/xwiki/rest/wikis/xwiki/spaces/Europe/France/Paris/pages/
But this url has an other meaning: list all pages of the space
Europe.France.Paris
I have proposed to escape the space name for this kind of use-case, like
this:
/xwiki/rest/wikis/xwiki/spaces/Europe/France/Paris/~pages/
But this escaping using "~" is not very RESTful (it would be a custom,
xwiki-specific, standard).
Meanwhile the solution 2 does not have this drawback:
/xwiki/rest/wikis/xwiki/spaces/Europe/spaces/France/spaces/Paris/pages/
is very clear. We have nothing to escape.
Thanks,
2015-07-06 17:43 GMT+02:00 Guillaume "Louis-Marie" Delhumeau <
gdelhumeau(a)xwiki.com>gt;:
> Note: I am personally for 1).
>
> 2015-07-06 17:38 GMT+02:00 Thomas Mortagne :
>
>> On Mon, Jul 6, 2015 at 5:11 PM, Guillaume "Louis-Marie" Delhumeau
>> wrote:
>> > Let me resume everything.
>> >
>> > It seems that jax-rs does not have a solution for handling list
>> parameters
>> > [1] (except by using a query string, or matrix parameters, which we
>> don't
>> > want). But, thanks to some hacks (example there:
>> >
>>
https://github.com/xwiki/xwiki-platform/compare/d5f4997ddf40d70c8eef9a9ee0e…
>> )
>> > we can manage to do it. We might find better solution afterwards.
>> >
>> > So we have several choices:
>> > 1 - /xwiki/rest/wikis/xwiki/spaces/Europe/France/Paris/pages/WebHome -
>> "/"
>> > as separator for nested spaces
>> > 2 - Edouard's proposition:
>> >
>> /xwiki/rest/wikis/xwiki/spaces/Europe/spaces/France/spaces/Paris/pages/WebHome
>> > - with multiple "spaces/" prefix
>> > 3 - Vincent's proposition -
>> > /xwiki/rest/v2/type/page/ref/wiki:Europe.France.Paris.WebHome - the
>> > reference version
>> >
>> > If we want to have this in M1, options 1 and 2 are more realistic.
>>
>> I don't think doing 3 is a good idea right now and this new concept
>> needs to be discussed more.
>>
>> 1 looks easier to implements and write but 2 is probably more
>> consistent with what we have today (plus it adds the feature of
>> listing the nested spaces of some space) so I'm more for 2.
>>
>> >
>> > [1]
>> >
>>
http://cxf.547215.n5.nabble.com/Passing-array-as-a-parameter-in-JAX-RS-td56…
>> >
>> > Thanks,
>> > Guillaume
[snip]