jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: HttpServletRequest#getPushBuilder

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Fri, 27 Jan 2017 14:56:33 -0800

ok. We will remove NoOpPushBuilder in this case as the implementation does not match the javadoc.
And we will have the following in javadoc:
        If the current connection does not support server push, or server push has been disabled by the
        client via a {_at_code SETTINGS_ENABLE_PUSH} settings frame value of {_at_code 0} (zero), it will return null.

Since null is a valid, we can provide valid default method as follows:
default public String PushBuilder getPushBuilder() {
        return null;
}

If we do this, it means by default, push is not supported.
Or we do not want the push to be not supported by default (and hence without default method.)

I would like to listen to options of EG on this.
Please let me know your comment.
Thanks.

Shing Wai Chan




> On Jan 25, 2017, at 1:41 AM, Mark Thomas <markt_at_apache.org> wrote:
>
> 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
>>
>>
>