-
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
HTTP/2 Request Response Multiplexing
11
Connections, Streams, Messages, Frames
-
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
-
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.
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.
This is a Title Slide with Picture and Logo slide ideal for including a picture and partner or product logo with a brief title, subtitle and presenter information.
To customize this slide with your own picture:
Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert.
To Replace the LOGO on this sample slide:
Right-click the sample LOGO and choose Change Picture. Navigate to the location where the new logo is stored, select desired logo file and click on the Open button to replace the sample logo.
To copy the Customized Background from Another Presentation on PC
Click New Slide from the Home tab's Slides group and select Reuse Slides.
Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy.
Check Keep Source Formatting and click the slide that contains the background you want.
Click the left-hand slide preview to which you wish to apply the new master layout.
Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery.
Delete any unwanted slides or duplicates.
To copy the Customized Background from Another Presentation on Mac
Click New Slide from the Home tab's Slides group and select Insert Slides from Other Presentation…
Navigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box.
Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides.
Click the left-hand slide preview to which you wish to apply the new master layout.
Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery.
Delete any unwanted slides or duplicates.
This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template.
One of the Safe Harbor slides must be used if your presentation covers material affected by Oracle’s Revenue Recognition Policy
To learn more about this policy, e-mail: Revrec-americasiebc_us@oracle.com
For internal communication, Safe Harbor Statements are not required. However, there is an applicable disclaimer (Exhibit E) that should be used, found in the Oracle Revenue Recognition Policy for Future Product Communications. Copy and paste this link into a web browser, to find out more information.
http://my.oracle.com/site/fin/gfo/GlobalProcesses/cnt452504.pdf
For all external communications such as press release, roadmaps, PowerPoint presentations, Safe Harbor Statements are required. You can refer to the link mentioned above to find out additional information/disclaimers required depending on your audience.
This is a Remote Speaker Picture slide ideal for including a picture with the speaker’s name and title and company.
To Replace the Picture on this sample slide (this applies to all slides in this template that contain replaceable pictures)
Select the sample picture and press Delete. Click the icon inside the shape to open the Insert Picture dialog box. Navigate to the location where the picture is stored, select desired picture and click on the Insert button to fit the image proportionally within the shape.
Note: Do not right-click the image to change the picture inside the picture placeholder. This will change the frame size of the picture placeholder. Instead, follow the steps outlined above.
This is a Remote Speaker Picture slide ideal for including a picture with the speaker’s name and title and company.
To Replace the Picture on this sample slide (this applies to all slides in this template that contain replaceable pictures)
Select the sample picture and press Delete. Click the icon inside the shape to open the Insert Picture dialog box. Navigate to the location where the picture is stored, select desired picture and click on the Insert button to fit the image proportionally within the shape.
Note: Do not right-click the image to change the picture inside the picture placeholder. This will change the frame size of the picture placeholder. Instead, follow the steps outlined above.
This is a Remote Speaker Picture slide ideal for including a picture with the speaker’s name and title and company.
To Replace the Picture on this sample slide (this applies to all slides in this template that contain replaceable pictures)
Select the sample picture and press Delete. Click the icon inside the shape to open the Insert Picture dialog box. Navigate to the location where the picture is stored, select desired picture and click on the Insert button to fit the image proportionally within the shape.
Note: Do not right-click the image to change the picture inside the picture placeholder. This will change the frame size of the picture placeholder. Instead, follow the steps outlined above.
Plug ACM
Patterns: Foreshadow use of Server Push with JSF later
It's a facility to allow the server to pre-populate the browser's cache with data it knows the browser will need anyway.
Here is where you mention that this is not a replacement for WebSocket. It can be used in concert with SSE
Fully bi-directional at the protocol level, no HOL blocking.
Message, not just request and response, there are also control messages.
httpbis draft 14.
Length shows how long the entire frame is.
Flags are used for several purposes, one of which is to indicate that this is the end of the header, or the end of the stream.
DATA is request or response body
HEADERS is the request or response header
RST_STREAM corresponds to an error
SETTINGS allows you to send configuration data for a given stream.
PUSH_PROMISE: related to server push
PING if the connection is still alive. This is necessary because the impact of closing down and opening a new socket is a bigger deal. In h1, if there was a problem on a socket, just close it
and open up another one. In h2, sockets are treated with more respect.
GOAWAY allows graceful closing of the socket.
WINDOW_UPDATE is for flow control. If the server is sending more data than the client can handle, the client can tell the server to send less.
CONTINUATION when one frame is a continuation of another one.
The features in gray are deemed too low level to expose in Servlet, an application level abstraction.
This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template.
One of the Safe Harbor slides must be used if your presentation covers material affected by Oracle’s Revenue Recognition Policy
To learn more about this policy, e-mail: Revrec-americasiebc_us@oracle.com
For internal communication, Safe Harbor Statements are not required. However, there is an applicable disclaimer (Exhibit E) that should be used, found in the Oracle Revenue Recognition Policy for Future Product Communications. Copy and paste this link into a web browser, to find out more information.
http://my.oracle.com/site/fin/gfo/GlobalProcesses/cnt452504.pdf
For all external communications such as press release, roadmaps, PowerPoint presentations, Safe Harbor Statements are required. You can refer to the link mentioned above to find out additional information/disclaimers required depending on your audience.