@delabassee JSON-‐P 1.1 Java API for JSON Processing • Keep JSON-‐P spec up-‐to-‐date • Track new standards • Add editing operations to JsonObject and JsonArray • Java SE 8 • JSON Big Data 9
@delabassee JSON-‐B • API to marshal/unmarshal Java objects to/from JSON – Similar to JAXB runtime API in XML world • Default mapping of classes to JSON – Annotations to customize the default mappings – JsonProperty, JsonTransient, JsonNillable, JsonValue, … Java API for JSON Binding 27
@delabassee JSON-‐B • Draw from best practices of existing JSON binding implementations – Jackson, Genson, EclipseLink MOXy, Fleece, JSON-‐lib, Gson, Flexjson, Json-‐io, JSONiJ, Johnzon, Xstream, etc. • Switch JSON binding providers • Implementations compete on common ground Standard API 28
@delabassee JAX-‐RS 2.1 30 • Alignment with MVC and JSON-‐B • Improving integration with CDI • NIO support in providers (filters, interceptors, …) • Building upon the hypermedia API • Reactive API • Server-‐sent Events
@delabassee • Part of HTML5 standardization • Server-‐to-‐client streaming of text data • Media type: “text/event-‐stream” • Long-‐lived HTTP connection – Client establishes connection – Server pushes update notifications to client 32 JAX-‐RS 2.1 Server-‐sent Events
@delabassee • Servlet, WebSocket, JAX-‐RS or standalone API? • JAX-‐RS deemed most natural fit – Streaming HTTP resources already supported – Small extension • Server API: new media type; EventOutput • Client API: new handler for server side events – Convenience of mixing with other HTTP operations; new media type – Jersey already supports SSE 33 JAX-‐RS 2.1 Server-‐sent Events
@delabassee Server-‐sent Events @Path("tickers") public class StockTicker { … @Get @Produces("text/event-‐stream") public EventOutput getQuotes() { EventOutput eo = new EventOutput(); new StockThread(eo).start() return eo; } } JAX-‐RS resource class 34
@delabassee HTTP 1.1 circa 1999 • HoLB • HTTP uses TCP poorly - HTTP flows are short and bursty - TCP was built for long-‐lived flows • Solutions - File concatenations, Assets Inlining, Domain sharding, etc. Problems Vs Solutions 37
@delabassee HTTP/2 • HTTP/2 – Hypertext Transfer Protocol version 2 -‐ RFC 7540 – HPACK -‐ Header Compression for HTTP/2 -‐ RFC 7541 • Reduce latency • Address the HOL blocking problem • Support parallelism • Define interaction with HTTP 1.x • Retain semantics of HTTP 1.x Address the Limitations of HTTP 1.x 38
@delabassee Adoption 39 Last year we announced our intent to end support for the experimental protocol SPDY in favor of the standardized version, HTTP/2. HTTP/2 is the next-‐generation protocol for transferring information on the web, improving upon HTTP/1.1 with more features leading to better performance. Since then we've seen huge adoption of HTTP/2 from both web servers and browsers, with most now supporting HTTP/2. Over 25% of resources in Chrome are currently served over HTTP/2, compared to less than 5% over SPDY. Based on such strong adoption, starting on May 15th — the anniversary of the HTTP/2 RFC — Chrome will no longer support SPDY. … http://blog.chromium.org/2016/02/transitioning-‐from-‐spdy-‐to-‐http2.html
@delabassee Adoption 40 http://caniuse.com/#search=http2 (1) Partial support in IE11 refers to being limited to Windows 10 (2) Only supports HTTP2 over TLS (3) Partial support in Safari refers to being limited to OSX 10.11+
@delabassee Adoption 40 http://caniuse.com/#search=http2 (1) Partial support in IE11 refers to being limited to Windows 10 (2) Only supports HTTP2 over TLS (3) Partial support in Safari refers to being limited to OSX 10.11+
@delabassee Action-‐based MVC • Controller(s) defined by the application • Examples – Struts 1 (EoL), Struts 2 – Spring MVC • UI landscape is not one size fits all • No standard Java EE implementation – JSR 371 – “Action-‐based” MVC 1.0 JSR – Targeted for inclusion in Java EE 8 51
@delabassee Controller • Combine data models and views to produce web application pages @Path("hello") public class HelloController { @GET @Controller public String hello() { // do something return “hello.jsp”; } } 53
@delabassee Controller • Class/method decorated with @Controller @Path(“hello") @Controller public class HelloController { @GET @View(“hello.md”) public void hello() { // do business stuff } } 54
@delabassee Controller @Path(“hello") @Controller public class HelloController { @GET public Viewable hello() { // some other stuff return new Viewable("hello.adoc"); } } 55
@delabassee Model @Path(“hello”) public class HelloController { @Inject private Models models; @GET @Controller public String hello() { models.set(“greeting”, new Greeting(“Salut”)); return “hello.jsp”; } } 59
@delabassee View • Define the structure of the output • Can refer to model(s) • Rendered by a View Engine – JSP – Facelets • Not accessible as static resources – /WEB-‐INF/views/ 60
@delabassee MVC • New annotations – @Controller, @View, @csrf, @RedirectScoped • Doing MVC now is not a bad idea – Leveraging CDI, JAX-‐RS, Facelets, BV – More? Servlet 4.0’s ServerPush – Easy migration path for JSPs • Offers more choices 63
@delabassee JavaServer Faces 65 • CDI Alignment – @Inject FacesContext, ExternalContext, etc. – CDI managed versions of Validator and Converter – Rely on CDI for EL resolving – Invoking CDI managed bean methods directly from Ajax, etc. • “Adjustments” for MVC • Misc. – Multi-‐field validation, etc.
@delabassee • The Aquarium – http://blogs.oracle.com/theaquarium • Java EE 8 Platform – http://javaee-‐spec.java.net • Java EE Reference Implementation – http://glassfish.org 69 More to Follow…