users@jsr311.java.net

Re: path segments, slashes and request matching

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 30 Oct 2008 17:04:11 -0400

Jersey also has an extension for extension-based conneg.

Marc.

On Oct 30, 2008, at 4:46 PM, Stephan Koops wrote:

> Hi Stephan,
>
> you could use the Restlet extension for JAX-RS (www.restlet.org). It
> supports content negotiation by file extensions transparently for
> the client for GET requests. For other HTTP methods there are also
> possibilities for it.
> You could join us at discuss_at_restlet.tigris.org .
>
> best regards
> Stephan
>
> Marc Hadley schrieb:
>> On Oct 30, 2008, at 7:10 AM, Stephan Feder wrote:
>>>
>>> the 1.0 spec insists on operating on path segments (i.e. slashes
>>> are implied all over the place). This is unnecessarily limitating.
>>>
>>> The following pseudo example does not do what I expect (it matches
>>> "index./html" instead of "index.html").
>>>
>>> @Path("index.")
>>> public class Index {
>>>
>>> @GET @Path("html") @Produces("text/html")
>>> public Response html() { ... }
>>>
>>> @GET @Path("xml") @Produces("text/xml")
>>> public Response xml() { .... }
>>> }
>>>
>> At one point we did support extension-based conneg in the spec but
>> we removed it following negative feedback. You can get the kind of
>> functionality you want by including the "index." in your method
>> path templates (removing it from the class level @Path) or by
>> introducing a second level dispatch with a template like "index.
>> {ext}".
>>
>>> I would have written in the spec
>>>
>> <snip/>
>>
>>> Assuming that all Path annotations would state exactly which
>>> slashes they expect I do not see any regression.
>>>
>> That's an assumption I don't think we can make, the changes you
>> suggest would introduce a backwards compatibility problem.
>>
>> Marc.
>>
>> ---
>> Marc Hadley <marc.hadley at sun.com>
>> CTO Office, Sun Microsystems.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
>> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.