Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck

2,147 views

Published on

10 minute infodeck to present Servlet 4.0 at the2014-12-19 Adopt-a-JSR recorded meeting

Published in: Software
  • Be the first to comment

Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck

  1. 1. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Adopt-a-JSR: JSR-369 Servlet 4.0 Ed Burns and Dr. Shing-Wai Chan Spec Leads for Servlet Java EE Specification Team December, 2014
  2. 2. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  3. 3. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Ed Burns – Oracle • Long time user of Servlet technology • Co-spec lead of JSF since 2004 Speaker Credentials
  4. 4. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Ed Burns – Oracle • Long time user of Servlet technology • Co-spec lead of JSF since 2004 Speaker Credentials
  5. 5. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Dr. Shing Wai Chan – Oracle • Servlet Spec Lead since 2013 • Expert group member on many JSRs relating to Servlet since 2001 Speaker Credentials
  6. 6. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda HTTP2 Big Features How Servlet Might Expose These Features Adopt-a-JSR 1 2 3
  7. 7. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda HTTP2 Big Features How Servlet Might Expose These Features Adopt-a-JSR 1 2 3
  8. 8. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Request/Response multiplexing • Binary Framing • Stream Prioritization • Server Push • Header Compression • Upgrade from HTTP 1.1 • ALPN (or NPN) • 101 Switching Protocols 8 HTTP/2 Big Ticket Feature Review
  9. 9. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Server Push • Eliminates the need for resource inlining. • Lets the server populate the browser’s cache in advance of the browser asking for the resource to put in the cache. • No corresponding JavaScript API, but can be combined with SSE – Server pushes stuff into the browser’s cache. – Server uses SSE to tell the browser to go fetch it (but we know it’s already in the browser’s cache). 9 E
  10. 10. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Request Response Multiplexing • Fully bi-directional • Enabled by defining some terms – Connection A TCP socket – Stream A “channel” within a connection – Message A logical message, such as a request or a response – Frame The smallest unit of communication in HTTP/2. 10 Lets you do more things with a single TCP connection
  11. 11. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Request Response Multiplexing 11 Connections, Streams, Messages, Frames
  12. 12. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Request Response Multiplexing • Once you break the communication down into frames, you can interweave the logical streams over a single TCP connection. • Yet another idea from the 1960s is new again. 12 Connections, Streams, Messages, Frames Browser ServerSingle TCP connection for HTTP 2 STREAM'4' HEADERS' STREAM'9' HEADERS' STREAM'7' DATA' STREAM'7' HEADERS' STREAM'2' HEADERS' STREAM'2' DATA'
  13. 13. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | HTTP/2 Binary Framing • Solves Head-Of-Line (HOL) blocking problem • Type field can be DATA, HEADERS, PRIORITY, RST_STREAM, SETTINGS, PUSH_PROMISE, PING, GOAWAY, WINDOW_UPDATE, CONTINUATION 13 Enabled by dumping newline delimited ASCII Length (24) Type (8) Flags (8) R Stream Identifier (31) Frame Payload (0 …)
  14. 14. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda HTTP2 Big Features How Servlet Might Expose These Features Adopt-a-JSR 1 2 3
  15. 15. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Request/Response multiplexing • Binary Framing • Stream Prioritization • Server Push • Header Compression • Upgrade from HTTP 1.1 – ALPN or (NPN) – 101 Switching Protocols 15 HTTP/2 Features Servlet 4.0 Big Ticket New Features
  16. 16. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Request/Response multiplexing • Binary Framing • Stream Prioritization • Server Push • Header Compression • Upgrade from HTTP 1.1 – ALPN or (NPN) – 101 Switching Protocols 16 HTTP/2 Features Potentially Exposed in Servlet API Servlet 4.0 Big Ticket New Features
  17. 17. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | • Push resource to client for a given url and headers • May add callback for completion or error of a push • Not at all a replacement for WebSocket • Really useful for frameworks that build on Servlet, such as JSF 17 Server Push Servlet 4.0 Big Ticket New Features
  18. 18. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | 18 Server Push Servlet 4.0 Big Ticket New Features Browser Server Thread A servlet.service() GET /index.html Server discovers browser will need style.css and script.js request.dispatchPushRequest("style.css") request.dispatchPushRequest("script.js") Server Thread B servlet.service() synthetic GET /style.css synthetic GET /script.js Server Thread C servlet.service() style.css script.js index.html
  19. 19. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Server Push public class FacesServlet implements Servlet { public void service(ServletRequest req, ServletResponse resp) throws IOException, ServletException { //.. HttpServletRequest request = (HttpServletRequest) req; try { ResourceHandler handler = context.getApplication().getResourceHandler(); if (handler.isResourceRequest(context) || request.isPushRequest()) { handler.handleResourceRequest(context); } else { lifecycle.attachWindow(context); lifecycle.execute(context); lifecycle.render(context); } } } Example of Potential Use from JSF 19
  20. 20. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Server Push public class ExternalContextImpl extends ExternalContext { //… public String encodeResourceURL(String url) { if (null == url) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "url"); throw new NullPointerException(message); } Map attrs = getResourceAttrs(); ((HttpServletRequest) request).dispatchPushRequest(url, attrs); return ((HttpServletResponse) response).encodeURL(url); } //… } Example of Potential Use from JSF 20
  21. 21. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Program Agenda HTTP2 Big Features How Servlet Might Expose These Features Adopt-a-JSR 1 2 3
  22. 22. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
  23. 23. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Adopt-a-JSR • Community Tab on JSR-369 page https://jcp.org/en/egc/view?id=369 – JIRA Components: currently we have none. Come up with a list of components for us! – Use-cases for session-less applications – List of references to async and thread safety in the spec and javadoc – You can think of others!
  24. 24. Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

×