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.

Java EE 8 Overview (Japanese)

815 views

Published on

These slides were used at OSS Users study event, which was held in Tokyo on December 12, 2017.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Java EE 8 Overview (Japanese)

  1. 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. 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. 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. 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java Enterprise Edition (Java EE) 4
  5. 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 5 Java EE is a set of specifications
  6. 6. 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 20131999 2017 Robustness Web Services Ease of Development Lightweight Productivity & HTML5 Enterprise Java Modernization & Simplification
  7. 7. 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 PaaSREST
  8. 8. 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
  9. 9. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 9 • Java • Java VM • Java EE Application Server Reference Implementation Java IT
  10. 10. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. The Road to Java EE 8 10
  11. 11. 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 20131999 2017 Robustness Web Services Ease of Development Lightweight Productivity & HTML5 Enterprise Java Modernization & Simplification
  12. 12. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE 8 • 2014: ... • 2016: ... • 2017.9.21 : Java EE 8 12
  13. 13. 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
  14. 14. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE Community Survey • Java EE 8 • Java EE 8 • – Servlet REST JSON – – Management JMS MVC 14 Java One 2016 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
  15. 15. 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
  16. 16. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Java EE 8 Contents: JSRs and MRs 16
  17. 17. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 17 Java EE 8 Web Tier HTTP/2 CDI
  18. 18. 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 API, Server-sent events CDI WebSocket Bean Validation Java SE 8 Java SE 8 (date/time, collections) JSON <-> Java Java SE JSON
  19. 19. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 19 Maintenance Releases For Java SE 9 (GlassFish 5.0 ) WebSocket 1.1JSR 356 Common Annotations 1.3JSR 250 JAXB 2.0JSR 222 JAX-WS 2.0Bean ValidationJSR 224 SAAJ 1.0JSR 67JavaMail 1.6JSR 919 Interceptors 1.2 rev AJSR 318 Java Persistence 2.2JSR 338 JAF 1.2JSR 925
  20. 20. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-P 20
  21. 21. 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 8 Streams API – JSONCollectors 21 JSON-P
  22. 22. 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
  23. 23. 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}} ]
  24. 24. 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}} ]
  25. 25. 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
  26. 26. 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}} ]
  27. 27. 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
  28. 28. 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
  29. 29. 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
  30. 30. 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 Lambda JSON Query JSON
  31. 31. 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
  32. 32. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-B 32
  33. 33. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-B 1.0 • Java JSON / API – Java à JSON – JSON à Java • API – Annotation (@JsonbProperty @JsonbNillable) – Runtime configuration builder • JSON Binding 33 Java API for JSON Binding
  34. 34. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JSON-B 1.0 • JsonBuilder – JSON API – • Jsonb – JSON – fromJson: JSON Java – toJson: Java JSON 34 Java API for JSON Binding
  35. 35. 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 } ]
  36. 36. 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
  37. 37. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • • • • Null • • • • Encoding • Adapters … 37
  38. 38. 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
  39. 39. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. JAX-RS 39
  40. 40. 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
  41. 41. 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.0 Client API
  42. 42. 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.0 Client API
  43. 43. 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.0 Client API
  44. 44. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 44 Orchestration JAX-RS 2.0
  45. 45. 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.
  46. 46. 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.
  47. 47. 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.
  48. 48. 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.
  49. 49. 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
  50. 50. 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
  51. 51. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Server-Sent Events (SSE) • – • HTTP – "text/event-stream" • – ID – 51
  52. 52. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Server-Sent Events (SSE) 52 Source : https://caniuse.com/
  53. 53. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. SSE Client API • SseEventSource – Web – Consumer – • InboundSseEvent – – 53
  54. 54. 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
  55. 55. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. SSE Server API • SseEventSink – – HTTP – OutboundSseEvent • Sse – OutboundSseEvent SseBroadcaster • OutboundSseEvent – 1 • SseBroadcaster – 55
  56. 56. 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
  57. 57. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. CDI 57
  58. 58. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. • 3 – CDI Core – CDI for Java SE • Java SE CDI API – CDI for Java EE • Observer • • • Java SE 8 Stream API Lambda • SPI Configurator • Observer • Producer Interceptor 58 CDI 2.0
  59. 59. 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
  60. 60. 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
  61. 61. 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
  62. 62. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Event Observer • Event – paymentEvent.fire(new PaymentEvent(100)); – paymentEvent.fireAsync(new PaymentEvent(200)); • Event Observer Event Observer • Observer 62
  63. 63. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Web Tier Servlet, HTTP/2, and JSF 63
  64. 64. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. HTTP/2 • • • Head-of-Line Blocking • HTTP 1.1 64 HTTP 1.x
  65. 65. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. HTTP/2 • 1 – – • • Stream • • • HTTP 1.1 65
  66. 66. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 66 HTTP/2 TCP 1 Stream 4 Data Stream 1 Headers Stream 1 Data Stream 2 Headers Stream 3 Headers Stream 2 Data
  67. 67. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Servlet 4.0 • HTTP/2 – – – HTTP 1.1 • HTTP 1.1 RFC • – – jsp – – Servlet Mapping API 67
  68. 68. 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
  69. 69. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. URL • getMappingMatch() – MappingMatch • getPattern() – Servlet URL • getMatchValue() – URI • getServletName() – Servlet 69 HttpServletMapping
  70. 70. 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(); ...
  71. 71. 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 getServletName MainServlet
  72. 72. 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
  73. 73. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Bean Validation 73
  74. 74. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Bean Validation 2.0 • Java SE 8 – Date and Time API – Collection – Optional – • – @NotEmpty, @NotBlank, @Email, @Positive, @Negative, @PositiveOrZero, @NegativeOrZero, @PastOrPresent, @FutureOrPresent • 74
  75. 75. 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)
  76. 76. 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)
  77. 77. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Security 77
  78. 78. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Security API for Java EE • API – SecurityContext – HttpAuthenticationMechanism – IdentityStore • • CDI 78 Java EE API
  79. 79. 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
  80. 80. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. HttpAuthenticationMechanism • Web Caller – Servlet • JASPIC ServerAuthModule SPI Interface – validateRequest() : doFilter() service() – secureResponse() : doFilter() service() – cleanSubject() : logout() • • IdentityStore 80 Servlet
  81. 81. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. IdentityStore • • – LDAP Database – Authentication Authorization • – validate(Credential) - CredentialValidationResult – getCallerGroups(CredentialValidationResult) 81 JAAS
  82. 82. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 82
  83. 83. 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
  84. 84. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Summary 84
  85. 85. 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
  86. 86. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 86 Java EE 8 Full Profile Connector JAXBJSP Debugging Managed Beans Concurrency EE Interceptors JAX-WS WebSocket JASPIC JMS JTADeployment Batch JACC Dependency Injection JAXR JSTL Management EJB JAX-RPC Web ServicesJPA Common Annotations EL Web Services Metadata JavaMail CDI JSON-B Security Bean Validation JSF JAX-RS JSON-P Servlet JSP Maintenance Release Update New
  87. 87. 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
  88. 88. 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
  89. 89. 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

×