[jsr369-experts] Relative PushBuilders

From: Greg Wilkins <gregw_at_webtide.com>
Date: Wed, 11 Jan 2017 12:36:40 +1100


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?


Greg Wilkins <gregw@webtide.com> CTO http://webtide.com