jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] Re: HttpServletRequest#getPushBuilder

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Mon, 30 Jan 2017 15:18:57 -0800

If there is no objection, I will add “default” method to return null and update the javadoc as shown below.
Please respond by close of business PST Thursday otherwise I’ll specify the above the proposal.

Thanks.
Shing Wai Chan


> On Jan 27, 2017, at 2:56 PM, Shing Wai Chan <shing.wai.chan_at_oracle.com> wrote:
>
> 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
>>>
>>>
>>
>