users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] Re: forward()

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 11 Sep 2013 16:19:22 +0100

On 11/09/13 14:04, Bill Burke wrote:
> Hey,
>
> I'm working on my first Angular JS web UI application. Angular JS is
> REST based, so it works great with a JAX-RS backend. The only thing
> that is really missing in JAX-RS at the moment, is a servlet forward().
> I often need to forward the request to .html, .jsp, or JSF pages
> within the WAR.
>
> A could inject HttpServletRequest and do the forward, but the JAX-RS
> implementation is going to have to be aware that you're doing a forward,
> otherwise, it will try to send back a response.
>
> Do we need a forward() method somewhere? LIke on ResourceContext or
> something? Or do we need explicit language in the spec that JAX-RS
> implementations need to handle servlet forwards gracefully.
>
We do it at MBW level and ensure the runtime does not try to handle the
response after the forward, basic and non-intrusive solution,
Good point about the runtime having to be aware about an explicit
forward though,
I'd have no problems with updating ResourceContext - the only concern
is, the kind of info needed to do the forward (resource name, etc) are
better off be configured elsewhere

Cheers, Sergey