users@servlet-spec.java.net

[servlet-spec users] [jsr369-experts] Re: Relative PushBuilders

From: Mark Thomas <markt_at_apache.org>
Date: Wed, 11 Jan 2017 10:11:52 +0000

On 11/01/2017 01:36, Greg Wilkins wrote:
>
> All,
>
> we've noticed a bit of a non sequitur with the PushBuilder API when
> compared to the RequestDispatcher API.
>
> RequestDispatchers can be obtained either from a ServletRequest, in
> which case a path starting with '/' is relative to context and non '/'
> is relative to the request; or from a ServletContext, in which case the
> path is relative to the context root. The only way to dispatch to
> another context is to obtain a reference to the other ServletContext.
>
> With PushBuilder, we still get the builder from the request, but paths
> starting with '/' are absolute in the server and non '/' are relative to
> the context path.
>
> This has caused some confusion for some users as it is surprisingly
> different to RequestDispatcher, although it is similar to sendRedirect.
>
> If it was not for sendRedirect, I'd strongly be in favour of changing so
> that a PushBuilder is always reletive to the context from which it was
> obtained (and we'd need a new method on ServletContext to get one for
> another context).
>
> But as it is similar to sendRedirect, I'm not so keen on a change... but
> thought I'd at least mention it to see what others think?

I haven't seen any feedback from users on this but my instinct would be
to expect behaviour more similar to RequestDispatcher than sendRedirect.

Mark