Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Java EE 8 Overview (Japanese)

Java EE 8 Overview (Japanese)

Overview of Java EE 8, which was delivered to Japanese audience.

Akihiro Nishikawa

December 12, 2017
Tweet

More Decks by Akihiro Nishikawa

Other Decks in Technology

Transcript

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

    Java EE   OSS    <OSS X Users Meeting> #21 Java EE Akihiro Nishikawa Oracle Corporation Japan December 12, 2017 1
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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 -)( "
  8. 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
  9. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    Java EE 8 • 2014:   ... • 2016:   ... • 2017.9.21 : Java EE 8 12
  10. 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
  11. 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  $
  12. 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     
  13. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    17 Java EE 8 %)# Web Tier  HTTP/2%*#   CDI  '("  &!$
  14. 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,
  15. 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
  16. 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 !$(%-&
  17. 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
  18. 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}} ]
  19. 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}} ]
  20. 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
  21. 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}} ]
  22. 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
  23. 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
  24. 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 
  25. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    JsonCollectors JsonArray contacts = ... List<String> femaleNames = contacts.getValuesAs(JsonObject.class).stream() .filter(x -> "F".equals(x.getString("gender"))) .map(x -> (x.getString("name"))) .collect(Collectors.toList()); 30  LambdaJSONQuery JSON   
  26. 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 JsonCollectors JSON  
  27. 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
  28. 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<!   – fromJson: JSONJava1%!,;#:*:);)6<+$65' – toJson: Java1%!,;#:*:);)6<JSON* &,$65' 34 Java API for JSON Binding
  29. 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<Car> 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 } ]
  30. 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   
  31. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

     ( • '*%" • '*%" • '*%" • Null  • + +  ( • &,)$'*%" •  &,(!# • Encoding  • Adapters … 37
  32. 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
  33. 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
  34. 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
  35. 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<String> response = myResource.request(MediaType.TEXT_PLAIN) .async() .get(String.class); // ... JAX-RS 2.0Client API
  36. 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<Customer> fCustomer = myResource.request(MediaType.TEXT_PLAIN) .async() .get(new InvocationCallback<Customer>(){ @Override public void completed(Customer customer) { // work on the customer } @Override public void failed(Throwable throwable) { // Oops! } }); JAX-RS 2.0Client API
  37. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

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

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

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

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

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

    SSE Client API • SseEventSource – Web"  – !Consumer –   • InboundSseEvent – !"   –  !"    53
  47. 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
  48. 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
  49. 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
  50. 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
  51. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    CDI 1.1 @Inject private Event<PaymentEvent> 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
  52. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    CDI 2.0 @Inject private Event<PaymentEvent> 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  
  53. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    CDI 2.0 @Inject private Event<PaymentEvent> paymentEvent; // event producer CompletionStage<PaymentEvent> 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 
  54. 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
  55. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    HTTP/2 • 8&0:, • < $"= $+5;1 • 4/2'37&:39/(:*<Head-of-Line Blocking= • HTTP 1.1.6:0%)-   64 HTTP 1.x$ #!
  56. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    HTTP/2 • 1 4"!&)75&06&  –  –  &)482 • , +4-5816# • Stream  • $8,87.(%3 • /(' • HTTP 1.1(.#58* 65 7
  57. 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
  58. 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# – <F,B? "jsp;$'D – 4<F'@G5H4&0+C<1(G-I4&G, – Servlet Mapping API 67
  59. 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
  60. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    URL&#*(*'!) • getMappingMatch() – MappingMatch% • getPattern() – Servlet) $ URL"+* • getMatchValue() – )  URI"  • getServletName() – Servlet, - 69 HttpServletMapping
  61. 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(); ...
  62. 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
  63. 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
  64. 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
  65. 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)
  66. 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)
  67. 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 
  68. 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 !(&#%'  )'")
  69. 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
  70. 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- 
  71. Copyright © 2017, Oracle and/or its affiliates. All rights reserved.

    Java Persistence 2.2 • "! • Date and Time API " – java.time LocalDate, LocalTime, LocalDateTime, OffsetTime, OffsetDateTime ! •  Stream – Query : Stream getResultStream() – TypedQuery : Stream<x> getResultStream() • AttributeConverter CDI 83
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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