jsr369-experts@servlet-spec.java.net

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

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Mon, 30 Jan 2017 23:34:43 -0800

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.
Thanks.

Shing Wai Chan

> On Jan 30, 2017, at 10:21 PM, Greg Wilkins <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@webtide.com <mailto:gregw@webtide.com>> CTO http://webtide.com <http://webtide.com/>