jsr369-experts@servlet-spec.java.net

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

From: Mark Thomas <markt_at_apache.org>
Date: Wed, 1 Feb 2017 09:42:04 +0000

On 31/01/2017 07:34, Shing Wai Chan wrote:
> I have just checked our Servlet API workspace. The #isPushSupported is
> not there.
> So, I think we are safe to have “null” return in this case.

+1

null return and no "isPushSupported()" was where my thinking had got to
as well.

Mark


> Thanks.
>
> Shing Wai Chan
>
>> On Jan 30, 2017, at 10:21 PM, Greg Wilkins <gregw_at_webtide.com
>> <mailto:gregw_at_webtide.com>> wrote:
>>
>>
>> I thought we had discussed this before and in the end decided a noop
>> builder was desirable because of the intrinsic race condition that
>> exists with code like:
>>
>> if (request.isPushSupported())
>> {
>> PushBuilder builder = request.getPushBuilder();
>> builder.path("/something.txt").push();
>> }
>>
>> Because push can be disabled at any time, there is a non obvious race
>> in the above code. If push is disabled by a settings frame after the
>> condition, then a NPE could result. I doubt many will actually
>> write the code:
>>
>> if (request.isPushSupported())
>> {
>> PushBuilder builder = request.getPushBuilder();
>> if (builder !=null )
>> {
>> builder.path("/something.txt").push();
>> }
>> }
>>
>> Note also that the final push can still end up being a noop if a
>> settings frame disables push while the builder is being used.
>>
>> If we want the null return, then I think we need to remove
>> isPushSupported, so that the only valid code is:
>>
>> PushBuilder builder = request.getPushBuilder();
>> if (builder !=null )
>> {
>> builder.path("/something.txt").push();
>> }
>>
>> cheers
>>
>>
>>
>>
>>
>> On 31 January 2017 at 10:25, Edward Burns <edward.burns_at_oracle.com
>> <mailto:edward.burns_at_oracle.com>> wrote:
>>
>> >>>>> On Mon, 30 Jan 2017 15:18:57 -0800, Shing Wai Chan
>> <shing.wai.chan_at_oracle.com <mailto:shing.wai.chan_at_oracle.com>> said:
>>
>> SW> If there is no objection, I will add default method to return null
>> SW> and update the javadoc as shown below. Please respond by close of
>> SW> business PST Thursday otherwise Ill specify the above the
>> proposal.
>>
>> Looks good to me.
>>
>> Ed
>>
>> --
>> | edward.burns_at_oracle.com <mailto:edward.burns_at_oracle.com> |
>> office: +1 407 458 0017 <tel:%2B1%20407%20458%200017>
>> | 26 business days until planned start of JSF 2.3 Final Approval
>> Ballot
>> | 16 business days until DevNexus 2017
>> | 41 business days until JavaLand 2017
>>
>>
>>
>>
>> --
>> Greg Wilkins <gregw_at_webtide.com <mailto:gregw_at_webtide.com>> CTO
>> http://webtide.com <http://webtide.com/>
>