Hi Tim,
Thanks for your mail. It’s interesting to hear that the trailing slash
can also be relevant on the server side. Quite a while ago, there was
some discussion on the trailing slash in the EXQuery issue tracker,
and back then I voted for treating both cases the same way (mostly
because I wasn’t sure how to deal with the second case [1]. Some more
input is valuable, though.
One option could be to treat paths with and without slash the same way
(as it is right now), but to do the distinction if *there are* two
%rest:path annotations, one with and one without slash. One problem I
see, however, is that there seems to be no such distinction in JAX-RS
(“A @Path value isn’t required to have leading or trailing slashes
(/). The JAX-RS runtime parses URI path templates the same whether or
not they have leading or trailing spaces.”, [2]), and in the past it
was always turned out to be the right decision not to deviate too much
from this spec…
Ideas are welcome,
Christian
[1] https://github.com/exquery/exquery/issues/19
[2] http://docs.oracle.com/cd/E19798-01/821-1841/ginpw/
On Sun, Apr 10, 2016 at 4:30 AM, Tim Thompson <timathom@gmail.com> wrote:
> Hello,
>
> Reading the draft RESTXQ spec[1], I have a question about path preference.
> Namely, can a bare trailing slash serve as a valid path segment?
>
> I am thinking about the pattern used by some linked data services to
> accommodate httpRange-14[2]. For example, VIAF (Virtual International
> Authority File), a popular service for library data, uses a trailing slash
> to differentiate between the URI for a real-world object and the URI for the
> Web resource that represents it.
>
> So, a GET request on the URI http://viaf.org/viaf/71387829 triggers a 303
> redirect to http://viaf.org/viaf/71387829/
>
> The RESTXQ implementation in BaseX does not seem to permit this pattern at
> present. If I create a resource function with a path annotation that ends in
> a trailing slash, the GET request returns 404.
>
> Any chance this feature could be supported? :)
>
> Best regards,
> Tim
>
> [1]
> http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-specification.html
> [2] https://en.wikipedia.org/wiki/HTTPRange-14
>
> --
> Tim A. Thompson
> Metadata Librarian (Spanish/Portuguese Specialty)
> Princeton University Library
>