Slide 1

Slide 1 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE OSS #21 Java EE Akihiro Nishikawa Oracle Corporation Japan December 12, 2017 1

Slide 2

Slide 2 text

Copyright © 2017, 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. 2

Slide 3

Slide 3 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Program Agenda 3 Java Enterprise Edition (Java EE) The Road to Java EE 8 Java EE 8 Contents : JSRs and MRs Summary 1 2 3 4

Slide 4

Slide 4 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java Enterprise Edition (Java EE) 4

Slide 5

Slide 5 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 5 Java EE is a set of specifications

Slide 6

Slide 6 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. J2EE 1.3 CMP, JCA J2EE 1.4 JAX-RPC Mgmt, Deployment Java EE 5 Annotations, EJB 3.0, JPA, JSF, JAXB, JAX-WS Java EE 6 JAX-RS, CDI, Servlet 3.0, Web Profile, Pruning Java EE 7 JAX-RS 2.0, JSON-P, WebSocket, JMS 2.0, Batch J2EE 1.2 Servlet, JSP, EJB, JMS Java EE 8 Servlet 4.0, JAX-RS 2.1, JSON-B JSON-P 1.1, Security 6 Java EE Platform 2001 2003 2006 2009 2013 1999 2017 Robustness Web Services Ease of Development Lightweight Productivity & HTML5 Enterprise Java Modernization & Simplification

Slide 7

Slide 7 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 7 Java EE APIs - Backbone of Leading Open Source Projects Java EE Containers Microservices Web Containers Web Frameworks PaaS REST

Slide 8

Slide 8 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 2017 Java SE 9 2014 Java SE 8 2011 Java SE 7 2006 Java SE 6 2004 Java SE 5 2002 J2SE1.4 2000 J2SE1.3 1998 J2SE1.2 1997 JDK1.1 8 2017 Java EE 8 2013 Java EE 7 2009 Java EE 6 2006 Java EE 5 2002 J2EE1.4 2001 J2EE1.3 1999 J2EE1.2

Slide 9

Slide 9 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 9 ,!*DF;?9=" • Java,* •Java VM, • Java EE Application Server, GReference ImplementationH ,#% Java>F7,67:A. 2 ,IT>E8F% +'&" ,CF5F% 67:A+ 4@B<:3+/1 $0 -)( "

Slide 10

Slide 10 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. The Road to Java EE 8 10

Slide 11

Slide 11 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. J2EE 1.3 CMP, JCA J2EE 1.4 JAX-RPC Mgmt, Deployment Java EE 5 Annotations, EJB 3.0, JPA, JSF, JAXB, JAX-WS Java EE 6 JAX-RS, CDI, Servlet 3.0, Web Profile, Pruning Java EE 7 JAX-RS 2.0, JSON-P, WebSocket, JMS 2.0, Batch J2EE 1.2 Servlet, JSP, EJB, JMS Java EE 8 Servlet 4.0, JAX-RS 2.1, JSON-B JSON-P 1.1, Security 11 Java EE 8 2001 2003 2006 2009 2013 1999 2017 Robustness Web Services Ease of Development Lightweight Productivity & HTML5 Enterprise Java Modernization & Simplification

Slide 12

Slide 12 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE 8 • 2014: ... • 2016: ... • 2017.9.21 : Java EE 8 12

Slide 13

Slide 13 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE 8 • Java EE 8 Platform and Web Profile • Contexts and Dependency Injection 2.0 (CDI) • Java API for JSON Binding 1.0 (JSON- B) • Java Message Service 2.1 (JMS) • Java Servlet 4.0 • Java API for RESTful Web Services 2.1 (JAX-RS) • Model-View-Controller 1.0 (MVC) • JavaServer Faces 2.3 (JSF) • Java EE Management API 2.0 • Java API for JSON Processing 1.1 (JSON-P) • Java EE Security API 1.0 • Bean Validation 2.0 13 2014 JSR

Slide 14

Slide 14 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE Community Survey • (*:5=A8C2Java EE 8) 0.,#"!7>?<:4) %3B6C;2 • *Java EE 8* ' • &* – DServlet!REST!JSON – *@@C92/1 – DManagement!JMS! MVC 14 Java One 2016)3B6C; * Java EE 8 * Java EE 8 JAX-RS 2.1 REST Services &*-- Servlet 4.0 HTTP/2 JSON-B 1.0 JSON-B JSON-P 1.1 JSON-P CDI 2.0 N/A Bean Validation 2.0 N/A JSF 2.3 N/A Security 1.0 N/A Management 2.0 Management Management 2.0 +$ JMS 2.1 JMS JMS 2.1+$ MVC 1.0 MVC $

Slide 15

Slide 15 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE 8 • Java EE 8 Platform and Web Profile • Contexts and Dependency Injection 2.0 (CDI) • Java API for JSON Binding 1.0 (JSON- B) • Java Message Service 2.1 (JMS) • Java Servlet 4.0 • Java API for RESTful Web Services 2.1 (JAX-RS) • Model-View-Controller 1.0 (MVC) • JavaServer Faces 2.3 (JSF) • Java EE Management API 2.0 • Java API for JSON Processing 1.1 (JSON-P) • Java EE Security API 1.0 • Bean Validation 2.0 15 2016

Slide 16

Slide 16 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE 8 Contents: JSRs and MRs 16

Slide 17

Slide 17 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 17 Java EE 8%)# Web Tier HTTP/2%*# CDI '(" &!$

Slide 18

Slide 18 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 18 Java EE 8 API Updates Servlet 4.0 JAX-RS 2.1 Security 1.0 JSF 2.3 Bean Validation 2.0 JSON-B 1.0 CDI 2.0 JSON-P 1.1 Bean Validation JSR 369 JSR 370 JSR 375 JSR 372 JSR 380 JSR 367 JSR 365 JSR 374 HTTP/2 performance – server push Reactive #4 7,API, Server-sent events +7**',("35*%7*"', CDIWebSocketBean ValidationJava SE 8 Java SE 8 (date/time, collections) JSON <-> Java- 7+7$+/!6,2).7$ 07, 07, Java SE&18, JSON &18,

Slide 19

Slide 19 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 19 Maintenance Releases For Java SE 9 (GlassFish 5.0) WebSocket 1.1 JSR 356 Common Annotations 1.3 JSR 250 JAXB 2.0 JSR 222 JAX-WS 2.0 Bean Validation JSR 224 SAAJ 1.0 JSR 67 JavaMail 1.6 JSR 919 Interceptors 1.2 rev A JSR 318 Java Persistence 2.2 JSR 338 JAF 1.2 JSR 925

Slide 20

Slide 20 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-P 20

Slide 21

Slide 21 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-P 1.1 • – RFC 7159 - The JavaScript Object Notation (JSON) Data Interchange Format – RFC 6901 – JSON Pointer – RFC 6902 – JSON Patch – RFC 7396 – JSON Merge Patch • JsonObject JsonArray , • Java SE 8Streams API)+'-"*# – JSONCollectors 21 JSON-P !$(%-&

Slide 22

Slide 22 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-Pointer • JSON "/0/user/address" • JsonPointer – getValue() – add() – remove() – replace() – containsValue() 22 IETF RFC 6901

Slide 23

Slide 23 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 23 JsonArray contacts = ... JsonPointer p = Json.createPointer("/0/phones/mobile"); JsonValue v = p.getValue(contacts); [ { "name":"Duke", "gender":"M", "phones":{ "home":"650-123-4567", "mobile":"650-234-5678"}}, { "name":"Jane", "gender":"F", "phones":{ "mobile":"707-555-9999}} ]

Slide 24

Slide 24 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 24 JsonArray contacts = ... JsonPointer p = Json.createPointer("/0/phones/mobile"); JsonReader reader = Json.createReader( new StringReader("¥"650-555-1212¥"")); JsonValue jsonValue = reader.readValue(); contacts = p.replace(contacts, jsonValue); [ { "name":"Duke", "gender":"M", "phones":{ "home":"650-123-4567", "mobile":"650-555-1212"}}, { "name":"Jane", "gender":"F", "phones":{ "mobile":"707-555-9999}} ]

Slide 25

Slide 25 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-Patch • JSON – "add", "remove", "replace", "move", "copy", "test" • JsonPatchBuilder – add, copy, move, remove, replace, test • JsonPatch – apply() – toJsonArray() 25 IETF RFC 6902

Slide 26

Slide 26 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 26 JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch patch = builder.replace("0/phones/mobile", "650-111-2222") .remove("/1").build(); JsonArray result = patch.apply(contacts); JSON [ { "name":"Duke", "gender":"M", "phones":{ "home":"650-123-4567", "mobile":"650-111-2222"}}, { "name":"Jane", "gender":"F", "phones":{ "mobile":"707-555-9999}} ]

Slide 27

Slide 27 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-Merge Patch Operation Original Patch Result Replace {"a" : "b"} {"a" : "c"} {"a" : "c"} {"a" : "b"} {"a" : null} {} Add {"a" : "b"} {"b" : "c"} {"a" : "b", "b" : "c" } Remove {"a" : "b", "b" : "c" } {"a" : null} {"b" : "c"} 27 IETF RFC 7396

Slide 28

Slide 28 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. MergePatch JsonValue source = Json.createValue("{¥"color¥":¥"blue¥"}"); JsonValue patch = Json.createValue("{¥"color¥":¥"red¥"}"); JsonMergePatch mergePatch = Json.createMergePatch(patch); JsonValue result = mergePatch.apply(source); // {"color":"red"} 28 Patch

Slide 29

Slide 29 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. MergePatch JsonValue source = Json.createValue("{¥"color¥":¥"red¥"}"); JsonValue target = Json.createValue("{¥"color¥":¥"blue¥"}"); JsonMergePatch mergePatch = Json.createMergeDiff(source, target); // {"color":"blue"} 29

Slide 30

Slide 30 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JsonCollectors JsonArray contacts = ... List femaleNames = contacts.getValuesAs(JsonObject.class).stream() .filter(x -> "F".equals(x.getString("gender"))) .map(x -> (x.getString("name"))) .collect(Collectors.toList()); 30 LambdaJSONQueryJSON

Slide 31

Slide 31 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JsonCollectors JsonArray contacts = ...; JsonArray femaleNames = contacts.getValuesAs(JsonObject.class).stream() .filter(x -> "F".equals(x.getString("gender"))) .map(x -> (x.get("name"))) .collect(JsonCollectors.toJsonArray()); 31 JsonCollectorsJSON

Slide 32

Slide 32 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-B 32

Slide 33

Slide 33 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-B 1.0 • JavaJSON!$% "/$% " API – % "& Java à JSON!$ – $% "& JSON!$ à Java • API – Annotation (@JsonbProperty @JsonbNillable) – Runtime configuration builder • JSON Binding# 33 Java API for JSON Binding

Slide 34

Slide 34 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-B 1.0 • JsonBuilder – JSON.:+:"API!5:,:-3:, – 28.( =28/*> • Jsonb – JSON.:+:"07<49

Slide 35

Slide 35 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 35 Car car1 = new Car(); car1.setBrand("Toyota"); car1.setModel("Prius"); car1.setStock(20); Car car2 = new Car(); car2.setBrand("Tesla"); ... List inventory = new ArrayList<>(); inventory.add(car1); inventory.add(car2); Jsonb jsonb = JsonbBuilder.create(); String json = jsonb.toJson(inventory); JSON-B 1.0 [ { "brand" : "Toyota", "model" : "Prius", "stock" : 20 }, { "brand" : "Tesla", "model" : "Model S", "stock" : 0 } ]

Slide 36

Slide 36 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. public class Customer { private int id; @JsonbProperty(“name”) private String firstName; private String getFirstName() { return firstName; } } @JsonbNillable @JsonbPropertyOrder(PropertyOrderStrat gy.REVERSE) public class Customer { @JsonbNumberFormat("#0") private int id; @JsonbProperty(“name”) private String firstName; private String getFirstName() { return firstName; } } 36

Slide 37

Slide 37 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. ( • '*%" • '*%" • '*%" • Null • + + ( • &,)$'*%" • &,(!# • Encoding • Adapters … 37

Slide 38

Slide 38 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Jsonb jsonb = JsonbBuilder.create(); //Ordering, naming strategy, encoding, Locale, ... JsonbConfig config = new JsonbConfig().withFormatting(true) .withAdapters(new CarAdapter()); Jsonb jsonb = JsonbBuilder.newBuilder("myProvider"); Jsonb jsonb = JsonbBuilder.create(config); 38 Runtime configuration builder

Slide 39

Slide 39 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JAX-RS 39

Slide 40

Slide 40 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JAX-RS 2.1 • Reactive Client API • Server-sent events • Hypermedia API enhancements • JSR – JSON-B – HTTP PATCH 40

Slide 41

Slide 41 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 41 // http://example.com/api/read/doe?dpt=1 WebTarget myResource = client.target("http://example.com/api/read") .register(SomeFilter.class) .path("{user}") .resolveTemplate("user", "joe") .queryParam("dpt", "1") .header("some-header", "true"); Response response = myResource.request(...).get(); // ... client.close(); JAX-RS 2.0Client API

Slide 42

Slide 42 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 42 Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/api/read"); Future response = myResource.request(MediaType.TEXT_PLAIN) .async() .get(String.class); // ... JAX-RS 2.0Client API

Slide 43

Slide 43 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 43 Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/api/read"); Future fCustomer = myResource.request(MediaType.TEXT_PLAIN) .async() .get(new InvocationCallback(){ @Override public void completed(Customer customer) { // work on the customer } @Override public void failed(Throwable throwable) { // Oops! } }); JAX-RS 2.0Client API

Slide 44

Slide 44 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 44 Orchestration JAX-RS 2.0

Slide 45

Slide 45 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 45 destination.path("recommended") .request() .header("Rx-User", "Async") .async() .get(new InvocationCallback>() { @Override public void completed(final List recommended) { final CountDownLatch innerLatch = new CountDownLatch(recommended.size()); final Map forecasts = Collections.synchronizedMap(new HashMap<>()); ... JAX-RS 2.0 (1/4) Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

Slide 46

Slide 46 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 46 for (final Destination dest : recommended) { forecasts.resolveTemplate("dest", dest.getDestination()) .request() .async() .get(new InvocationCallback() { @Override public void completed(final Forecast forecast) { forecasts.put(dest.getDestination(), forecast); innerLatch.countDown(); } ... JAX-RS 2.0 (2/4) Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

Slide 47

Slide 47 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 47 @Override public void failed(final Throwable throwable) { innerLatch.countDown(); } }); } try { if (!innerLatch.await(10, TimeUnit.SECONDS)) { // timeout } } catch (final InterruptedException e) { // Ooops, interrupted! } ... JAX-RS 2.0 (3/4) Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

Slide 48

Slide 48 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 48 // Continue with processing… } @Override public void failed(final Throwable throwable) { // Recommendation error } }); // Continue... JAX-RS 2.0 (4/4) Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

Slide 49

Slide 49 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JAX-RS 2.1 CompletionStage cs1 = ClientBuilder.newClient() .target("http://example.com/api") .request() .rx() .get(String.class); cs1.thenAccept(System.out::println); 49 Reactive Client API

Slide 50

Slide 50 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 50 CompletionStage cs1 = ClientBuilder.newClient() .target("http://example.com/service1/hello") .request() .rx() .get(String.class); CompletionStage cs2 = ClientBuilder.newClient() .target("http://example.com/service2/bonjour") .request() .rx() .get(String.class); CompletionStage concat = cs1.thenCombine(cs2, String::concat); concat.thenAccept(System.out::println); CompletionStage API

Slide 51

Slide 51 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Server-Sent Events (SSE) • 6*15' $0)3 – 6*-5'7/%"6 8 • HTTP,4'3-6! – /&#,9 "text/event-stream" • -5' – -5'&6#ID2'1/5'+63( – -5'.46(&6#+63( 51

Slide 52

Slide 52 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Server-Sent Events (SSE) 52 Source : https://caniuse.com/

Slide 53

Slide 53 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. SSE Client API • SseEventSource – Web" – !Consumer – • InboundSseEvent – !" – !" 53

Slide 54

Slide 54 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 54 Client client = ClientBuilder.newClient(); WebTarget target = client.target( "http://example.com/service/subscribe" ); try( SseEventSource eventSource = SseEventSource.target( target ) .reconnectingEvery ( 5, TimeUnit.SECONDS ) .build () ) { eventSource.register( System.out::println ); // ... eventSource.open(); // ... eventSource.close(); } SSE Client API

Slide 55

Slide 55 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. SSE Server API • SseEventSink – 1&5%.&(*4+0.5' – $0"!3)HTTP "3%'3% – $0"!3)"-3)6OutboundSseEvent7 • Sse – OutboundSseEventSseBroadcaster • OutboundSseEvent – "-3) 1$0"!3),25*#/%) • SseBroadcaster – "-3) ,25*#/%) 55

Slide 56

Slide 56 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 56 @GET @Path("subscribe") @Produces(MediaType.SERVER_SENT_EVENTS) public void subscribe(@Context SseEventSink eventSink, @Context Sse sse) { eventSink.send ( sse.newEventBuilder () .name ( "event-name" ) .data ( String.class, "Welcome!" ) .build () ); eventSink.send( sse.newEvent ( "an event" ) ); eventSink.send( sse.newEvent ( "another event" ) ); eventSink.close (); } SSE Server API

Slide 57

Slide 57 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. CDI 57

Slide 58

Slide 58 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • 23 – CDI Core – CDI for Java SE • Java SE'%1&/+CDI5D9< API – CDI for Java EE • Observer+" • ! 4>D: • .3=9F6@DEB9AC+ • Java SE 8+GStream API# Lambda)(H* • )SPI*%1 Configurator • Observer?78;+$0, • Producer-Interceptor2 58 CDI 2.0

Slide 59

Slide 59 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. CDI 1.1 @Inject private Event paymentEvent; // event producer paymentEvent.fire(new PaymentEvent(amt)); // event consumer A public void aObserver(@Observes PaymentEvent p) { // ... } // event consumer B public void bObserver(@Observes PaymentEvent p) { // ... } 59 Immutable

Slide 60

Slide 60 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. CDI 2.0 @Inject private Event paymentEvent; // event producer paymentEvent.fire(new PaymentEvent(amt)); // event consumer A public void aObserver(@Observes @Priority(10) PaymentEvent p) { // ... } // event consumer B public void bObserver(@Observes @Priority(20) PaymentEvent p) { // ... } 60

Slide 61

Slide 61 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. CDI 2.0 @Inject private Event paymentEvent; // event producer CompletionStage stage = paymentEvent.fireAsync(new PaymentEvent(amt)); // event consumer A public void aObserver(@ObservesAsync PaymentEvent p) { // ... } // event consumer B public void bObserver(@ObservesAsync PaymentEvent p) { // ... } 61

Slide 62

Slide 62 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. EventObserver • / Event – paymentEvent.fire(new PaymentEvent(100)); – paymentEvent.fireAsync(new PaymentEvent(200)); • Event Observer Event Observer • Observer , *$ "-/#.(!')),.%" &+./#.(!') 62

Slide 63

Slide 63 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Web Tier Servlet, HTTP/2, and JSF 63

Slide 64

Slide 64 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. HTTP/2 • 8&0:, • < $"=$+5;1 • 4/2'37&:39/(:*

Slide 65

Slide 65 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. HTTP/2 • 14"!&)75&06& – – &)482 • , +4-5816# • Stream • $8,87.(%3 • /(' • HTTP 1.1(.#58* 65 7

Slide 66

Slide 66 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 66 HTTP/2TCP1 Stream 4 Data Stream 1 Headers Stream 1 Data Stream 2 Headers Stream 3 Headers Stream 2 Data

Slide 67

Slide 67 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Servlet 4.0 • HTTP/2.=I5 – C+(05HE0=G0 – .I9IH<2/A – HTTP 1.1!%2<,EI6 • HTTP 1.1 RFC " # • ->A83&! – -G37 !4;)D5-G3*05H:0# –

Slide 68

Slide 68 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 68 ... PushBuilder pushBuilder = request.newPushBuilder(); pushBuilder.path( "images/myPhoto.png" ) .addHeader( "content-type", "image/png" ) .push (); Server Push

Slide 69

Slide 69 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. URL&#*(*'!) • getMappingMatch() – MappingMatch% • getPattern() – Servlet) $URL"+* • getMatchValue() – ) URI" • getServletName() – Servlet, - 69 HttpServletMapping

Slide 70

Slide 70 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 70 @WebServlet(urlPatterns = {"", "/", "/main", "*.html", "/main/*"}, name = "MainServlet") public class MainServlet extends HttpServlet { private static final long serialVersionUID = 1L; static final Logger logger = Logger.getLogger(MainServlet.class.getName()); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { HttpServletMapping httpServletMapping = req.getHttpServletMapping(); MappingMatch mappingMatch = httpServletMapping.getMappingMatch(); ...

Slide 71

Slide 71 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Matching getMappingMatch getMatchValue getPattern "" CONTEXT_ROOT "" "" "/" DEFAULT / "/main" EXACT main /main "/index.html" EXTENSION index *.html "/main/hello" PATH hello /main/* 71 getServletNameMainServlet

Slide 72

Slide 72 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSF 2.3 • CDI – – managed beans • Date and Time API%*" • WebSocket • Ajax& !# • ')$(Bean Validation • UIData UIRepeat 72

Slide 73

Slide 73 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Bean Validation 73

Slide 74

Slide 74 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Bean Validation 2.0 • Java SE 8 #,3( – Date and Time API#,3( – Collection – Optional0&+3 – *'3$/2 • – @NotEmpty, @NotBlank, @Email, @Positive, @Negative, @PositiveOrZero, @NegativeOrZero, @PastOrPresent, @FutureOrPresent • "-.)' 1! %( 74

Slide 75

Slide 75 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 75 @Past Year startYear = Year.of(2016); // repeating annotations @Size(min = 8, group = Default.class) @Size(min = 12, group = Admin.class) private String password; List<@NotNull @Email String> emails; String @NotNull @Email[] email; // constraints with container elements Map<@Valid Customer, @Valid Account> customerAccountInfo; Constraints (1/2)

Slide 76

Slide 76 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 76 // Optional Optional<@Past LocalDate> getEnrollmentDate(); // new Annotations @NotEmpty List<@NotBlank @Email String> customerEmails; Constraints (2/2)

Slide 77

Slide 77 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Security 77

Slide 78

Slide 78 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Security API for Java EE • API – SecurityContext – HttpAuthenticationMechanism – IdentityStore • *02',)%+*/"2#.1!&$ ,)%+ • CDI 78 Java EE& -/(API

Slide 79

Slide 79 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. SecurityContext • $ – authenticate() – getCallerPrincipal(), getPrincipalsByType() – isCallerinRole() – hasAccessToWebResource() • $ – HttpServletRequest.getUserPrincipal() HttpServletRequest.isUserInRole() – EJBContext.getCallerPrincipal() EJBContext.isCallerInRole() 79 !(%' )'")

Slide 80

Slide 80 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. HttpAuthenticationMechanism • Web%49'<*8;Caller – Servlet(;.2! • JASPIC ServerAuthModule SPI$7/:Interface – validateRequest() : doFilter()"service()6,-1 – secureResponse() : doFilter()"service()6,-1 – cleanSubject() : logout() 6,-1 • %49'<*8;3-'<+;&"(;.2(;.2" %49'<*8;# • IdentityStore 80 Servlet(;.2$)5<0

Slide 81

Slide 81 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. IdentityStore • ,0 0"&,0 0,0 0-0( • $( – LDAPDatabase – AuthenticationAuthorization • )#%' – 1validate(Credential) - CredentialValidationResult – 1getCallerGroups(CredentialValidationResult) 81 JAAS./*!+0-

Slide 82

Slide 82 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 82

Slide 83

Slide 83 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java Persistence 2.2 • "! • Date and Time API" – java.timeLocalDate, LocalTime, LocalDateTime, OffsetTime, OffsetDateTime ! • Stream – Query : Stream getResultStream() – TypedQuery : Stream getResultStream() • AttributeConverterCDI 83

Slide 84

Slide 84 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Summary 84

Slide 85

Slide 85 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE Development has been migrated from Java.net to GitHub https://javaee.github.io/ https://github.com/javaee 85

Slide 86

Slide 86 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 86 Java EE 8 Full Profile Connector JAXB JSP Debugging Managed Beans Concurrency EE Interceptors JAX-WS WebSocket JASPIC JMS JTA Deployment Batch JACC Dependency Injection JAXR JSTL Management EJB JAX-RPC Web Services JPA Common Annotations EL Web Services Metadata JavaMail CDI JSON-B Security Bean Validation JSF JAX-RS JSON-P Servlet JSP Maintenance Release Update New

Slide 87

Slide 87 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 87 Java EE 8 Web Profile JSP Debugging Managed Beans Interceptors WebSocket JASPIC JTA Dependency Injection JSTL EJB Lite JPA Common Annotations EL CDI JSON-B Security Bean Validation JSF JAX-RS JSON-P Servlet JSP Maintenance Release Update New

Slide 88

Slide 88 text

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Summary • Final Java EE 8 was shipped! • EE4J (Enterprise Eclipse for Java) project is now on going. • Fore more details on EE4J, stay tuned for Ito-san’s presentation! 88

Slide 89

Slide 89 text

Copyright © 2017, 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. 89

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

No content