users@jersey.java.net

[Jersey] Re: Dispatching a request from a Java Servlet to a Jersey Resource - is it possible? (client --> javax.servlet --> RequestDispatcher.include() --> Jersey Resource)

From: Paul Conway <paul.conway_at_integrate.co.uk>
Date: Mon, 20 Jan 2014 11:51:12 +0000

I should add that that RequestDispatcher.forward(..) works which seems
strange to me. If the dispatcher can 'find' the Jersey resource via one
method I would guess the other should work.


On 17 January 2014 13:10, Paul Conway <paul.conway_at_integrate.co.uk> wrote:

> Hi,
>
> So the application I am working on has a 'dispatcher' servlet that accepts
> bundled-up ajax requests, splits them out and loops over each individual
> request, using a RequestDispatcher.include() to delegate the handling of
> the request to the correct servlet. Once all servlets have been processed
> it returns the bundled response.
>
> The problem that I am having is that when one of the bundled requests is a
> call to my jersey api (/api/*), nothing happens and no response is added to
> the servlet output stream. I don't get any errors in the logs it just fails
> silently. If I make a call to my jersey api via a browser address-bar then
> it works perfectly however.
>
> Therefore I am wondering is what I am trying to do possible? If so are
> there any special configuration that needs to take place in the web.xml?
>
> I have also posted the question on StackOverflow but have not got a
> definitive answer. You can find the question here (contains code samples
> etc);
>
>
> http://stackoverflow.com/questions/21150488/how-to-dispatch-servlet-requests-to-jersey-resource-methods
>
> Thanks in advance,
> Paul
>