users@jersey.java.net

[Jersey] Re: ResourceContext.matchResource(URI)

From: Van Klaveren, Brian N. <bvan_at_slac.stanford.edu>
Date: Mon, 4 Nov 2013 14:13:12 -0800

Hi,

I responded to your stackoverflow post.

First off, I’m pretty positive what you want isn’t implemented. You can see how the URL is resolved by checking through org.glassfish.jersey.servlet.WebComponent’s service method.

This builds a ContainerRequest (initially instance named requestContext). Further into the stack from there, you get to org.glassfish.jersey.server.ServerRuntime and the process method. At this point, the ContainerRequest (just named request now) is used in a manner similar to, but much more comprehensive than the method I described. Jersey then checks all possible resource combinations and finds which one fits best.

So, I’m pretty confident it's not implemented yet. I’d suggest you examine your needs for this, and either wait til you get some sort of resolution on your bug, follow the solution I presented (aka build all possible paths from resource model, choose the longest one that matches your request URI), or implement the comprehensive solution which you can gleam from the classes/methods I mentioned earlier in this email. Or, email someone like marek.potociar at oracle.com, who might have more insight to this, although I’m sure he probably checks Jira.

So, I believe your bug is technically a feature request (or really, a feature continuation request) instead of a bug which requires a non-trivial amount of code to implement. Because of that, I wouldn’t get your hopes up on it being solved very soon, although I agree that it’s a nice, useful feature.

Hopefully this helps you.

Brian


On Nov 4, 2013, at 8:14 AM, cowwoc <cowwoc_at_bbs.darktech.org> wrote:

> Hi,
>
> You have 23 hours left to claim this bounty:
> http://stackoverflow.com/q/17284419/14731
>
> I'd love to know whether this can be implemented in Jersey 2.
>
> Thanks,
> Gili