jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: HttpServletRequest#getPushBuilder

From: Mark Thomas <markt_at_apache.org>
Date: Wed, 25 Jan 2017 09:41:53 +0000

On 25/01/2017 00:13, Shing Wai Chan wrote:
> In HttpServletRequest, we added a new method #getPushBuilder.
> And there is a “default” implementation of returning a NoOpPushBuilder, which is an no-op.
> And in this moment, the NoOpPushBuilder.method(“”) even does not throw IllegalArgumentException as specified in javadoc.
>
> Do we really want to have the default implementation in the HttpServletRequest#getPushBuilder?
> Pros:
> Any implementation of previous version of HttpServletRequest will compile with this new HttpServletRequest interface.
> Cons:
> If a framework updated to Servlet 4.0, then it is possible to “forget to update” the implementation of HttpServletRequest#getPushBuilder in some of the classes. And the runtime will pick up the NoOpPushBuilder which may not be desired.
>
> Should we remove the “default” implementation in HttpServletRequest#getPushBuilder?

I think we should remove it. The main reason for this is the concern I
have expressed before [1] that populating a PushBuilder is likely to be
a relatively expensive process. If push is not available, we should
simply return null.

Mark


[1]
https://java.net/projects/servlet-spec/lists/jsr369-experts/archive/2016-03/message/15


>
> Please let me know your comment.
> Thanks.
> Shing Wai Chan
>
>