users@jax-rs-spec.java.net

[jax-rs-spec users] Re: JAX-RS Routing

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 5 Nov 2013 12:38:52 -0500

On Nov 5, 2013, at 10:19 AM, Bill O'Neil <oneil5045_at_gmail.com> wrote:

> I apologize if my question was unclear. Yes I was referring to matching a URL with a Java resource method. If the algorithm is defined in the spec, I find it a little counterintuitive to have each JAX-RS implementation reimplement it if they are all supposed to behave the same way.

 The algorithm is fairly involved and relies on the existence of an (internal) application model, the definition of all of which is beyond the scope of the spec. The are some different ways of implementing and optimizing matching, so this is an area of innovation for each implementation. Standardizing all this would be pretty difficult.

>
> For the "web server" I wanted to write a thin wrapper around Twitter's Finagle and use JAX-RS to match a URL to a Java resource method. I realized I would have to implement this myself (Which would be quite a bit of work for a weekend project). I would try to pull in an existing implementation (possibly Jersey) but it kind of seems like overkill to include an entire framework just to reuse this single implementation.
>
> I was just curious if there is any reason not to include a default implementation?

 Basically what I described above. You're going to have pick an implementation for your task.

-- Santiago

> On Tue, Nov 5, 2013 at 9:47 AM, Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com> wrote:
> Bill,
>
> I'm not sure what you're referring to as routing in this case. Are you talking about "matching" a URL with a Java resource method? I'm also a bit confused about the "web server" part.
>
> In any case, there's an algorithm in the spec that describes the matching process, but each implementation has a different implementation of it.
>
> -- Santiago
>
> On Oct 31, 2013, at 1:24 PM, oneil5045_at_gmail.com wrote:
>
> > Is there any reason that the JAX-RS spec does not provide a default
> > routing implementation as well as UriBuilder? I am interested in
> > trying to write a web server that conforms to JAX-RS but I wouldn't
> > trust myself to implement routing to spec. I could pull in Jersey or
> > RESTEasy but that seems a bit much just for routing.
> >
> > Personally I would think routing is something you would want only one
> > implementation of. This way you know requests will behave the same
> > across different frameworks.
> >
> > Thanks,
> > Bill
>
>