Java Magazine, Nov/Dec 2017
Figure 1 Resource request satisfied by Server Push ORACLE COM JAVAMAGAZINE NOVEMBER DECEMBER 2017 16 java ee 8 clearly see that the protocol it uses is h2 short for HTTP 2 and the image was initiated via Push This confirms that Server Push was used to satisfy the resource request TLS Required for HTTP 2 You might have noticed in Figure 1 that the scheme of the request is HTTPS This is because all major browser vendors have chosen to implement HTTP 2 over Transport Layer Security TLS only However the specification does not mandate that a secure connection is required for successful HTTP 2 communication Browser vendors have made that decision on our behalf Care must be taken when using a new PushBuilder object A call to newPushBuilder will return null if the connection is not secure if the client does not support Server Push or if the client has requested to disable Server Push via the SETTINGS_ ENABLE_ PUSH parameter of a SETTINGS frame If you want to try this example for yourself you can clone the code from the GitHub repository Anatomy of a PushBuilder Each new instance of PushBuilder created by calling newPushBuilder is based upon the current HttpServletRequest instance It is initiated with the HTTP GET method and all headers are stripped out except for conditional range expect authorization and referrer headers PushBuilder implements the builder pattern where chained method calls are used to mutate the instance before calling the push method The resource path is the only configuration
You must have JavaScript enabled to view digital editions.