Aplicações HTML5 com Java EE 7 e NetBeans

6,503 views

Published on

Códigos usados na demonstração aqui:

https://github.com/glassfish/javaee7-examples

Published in: Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,503
On SlideShare
0
From Embeds
0
Number of Embeds
678
Actions
Shares
0
Downloads
82
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

Aplicações HTML5 com Java EE 7 e NetBeans

  1. 1. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132Aplicações HTML5 comJava EE 7 e NetBeansBruno BorgesOracle Product ManagerJava Evangelist@brunoborges
  2. 2. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 133Bruno BorgesOracle Product Manager / EvangelistDesenvolvedor, GamerEntusiasta em Java Embedded eJavaFXTwitter: @brunoborges
  3. 3. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 134Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16Agenda Do Java EE 6 ao Java EE 7 Construindo aplicações HTML5– WebSockets 1.0– JAX-RS 2.0– JavaServer Faces 2.2– JSON API 1.0 NetBeans e o suporte ao HTML5 Comunidade, Participação, Futuro
  4. 4. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 135Plataforma Java EE 610 Dezembro, 2009
  5. 5. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 136Java EE 6 – Estatísticas●50+ Milhões de Downloads de Componentes Java EE 6●#1 Escolha para Desenvolvedores Enterprise●#1 Plataforma de Desenvolvimento de Aplicações●Implementação mais Rápida de uma versão do Java EE
  6. 6. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 137Top Ten Features no Java EE 61. Empacotar EJB dentro de um WAR2. Injeção de Dependência Type-safe3. Deployment descriptors opcionais (web.xml, faces-config.xml)4. JSF padronizado com Facelets5. Uma única classe por EJB6. Extensões de Servlet e CDI7. CDI Events8. EJBContainer API9. Agendamento estilo Cron com @Schedule10. Web Profile
  7. 7. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 138Java EE 7está pronto!
  8. 8. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 139IntroducingJava EE 7Live Webcasthttp://bit.ly/javaee7launch
  9. 9. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1310Java EE 7 Escopo●Produtividade de Desenvolvimento– Menos código Boilerplate– Funcionalidades mais ricas– Mais convenções e defaults●Suporte a HTML5– WebSocket– JSON– HTML5 FormsJSR 342
  10. 10. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1311Java EE 7EJB 3.2Servlet 3.1CDIExtensionsBatch 1.0WebFragmentsJCA 1.7JMS 2.0JPA 2.1Managed Beans 1.0Concurrency 1.0CommonAnnotations 1.1Interceptors1.2, JTA 1.2CDI 1.1JSF 2.2,JSP 2.3,EL 3.0JAX-RS 2.0,JAX-WS 2.2JSON 1.0WebSocket 1.0
  11. 11. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1313Java EE 7 Web Profile Web Profile updated to include– JAX-RS– WebSocket– JSON-P– EJB 3.2 Lite Outras APIs
  12. 12. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1314Construindo aplicações HTML5 WebSocket 1.0 JAX-RS 2.0 JavaServer Faces 2.2 JSON-P API
  13. 13. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1315HTTP vs WebSockets Protocolo HTTP é half-duplex Gambiarras– Polling– Long polling– Streaming WebSocket resolve o problemade uma vez por todas– Full-duplex
  14. 14. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1316WebSockets Handshake Cliente solicita um UPGRADE Server confirma (Servlet 3.1) Cliente recebe o OK Inicia a sessão WebSockethttp://farata.github.io/slidedecks/state_of_websocket/slides.html#13.4
  15. 15. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1317Java API for WebSockets 1.0 API para definir WebSockets, tanto Client como Server– Annotation-driven (@ServerEndpoint)– Interface-driven (Endpoint)– Client (@ClientEndpoint) SPI para data frames– Negociação handshake na abertura do WebSocket Integração com o Java EE Web container
  16. 16. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1318Java API for WebSockets 1.0import javax.websocket.*;import javax.websocket.server.*;@ServerEndpoint(“/hello”)public class HelloBean {    @OnMessage    public String sayHello(String name) {        return “Hello “ + name;    }}
  17. 17. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1319Java API for WebSockets 1.0@ServerEndpoint(“/chat”)public class ChatBean {    @OnOpen    public void onOpen(Session peer) {        peers.add(peer);    }    @OnClose    public void onClose(Session peer) {        peers.remove(peer);    }    @OnMessage    public void message(String msg, Session client) {        peers.forEach(p ­> p.getRemote().sendMessage(msg));    }}
  18. 18. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1321Maven Archetype para o Java EE 7 Maven Archetypes para Java EE 7– http://mojo.codehaus.org Maven Archetype com o Embedded GlassFish configurado– http://github.com/glassfish/javaee7-archetype Agora só precisa...– $ mvn package embedded-glassfish:run
  19. 19. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1322JAX-RS 2.0 Client API Message Filters & Entity Interceptors Asynchronous Processing – Server & Client Suporte Hypermedia Common Configuration– Compartilhar configuração comum entre diversos serviçosREST
  20. 20. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1323JAX-RS 2.0 - Client// Get instance of ClientClient client = ClientFactory.getClient();// Get customer name for the shipped productsString name = client.target(“http://.../orders/{orderId}/customer”)                    .resolveTemplate(“orderId”, “10”)                    .queryParam(“shipped”, “true)”                    .request()                    .get(String.class);
  21. 21. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1324JAX-RS 2.0 - Server@Path("/async/longRunning")public class MyResource {@GETpublic void longRunningOp(@Suspended AsyncResponse ar) {ar.setTimeoutHandler(new MyTimoutHandler());ar.setTimeout(15, SECONDS);Executors.newSingleThreadExecutor().submit(new Runnable() {public void run() {...ar.resume(result);}});}}
  22. 22. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1325JavaServer Faces 2.2 Flow Faces HTML5 Friendly Markup Cross-site Request Forgery Protection Carregamento de Facelets via ResourceHandler Componente de File Upload Multi-templating
  23. 23. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1326JSON API 1.0 JsonParser– Processa JSON em modo “streaming”– Similar ao XMLStreamReader do StaX Como criar– Json.createParser(...)– Json.createParserFactory().createParser(...) Eventos do processador– START_ARRAY, END_ARRAY, START_OBJECT, END_OBJECT, ...
  24. 24. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1327JSON API 1.0"phoneNumber": [{"type": "home","number": ”408-123-4567”},{"type": ”work","number": ”408-987-6543”}]JsonGenerator jg = Json.createGenerator(...);jg..beginArray("phoneNumber").beginObject().add("type", "home").add("number", "408-123-4567").endObject().beginObject().add("type", ”work").add("number", "408-987-6543").endObject().endArray();jg.close();
  25. 25. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1328NetBeans e o suporteao HTML5
  26. 26. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1329NetBeans 7.3
  27. 27. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1330HTML5 Wizard Twitter Bootstrap HTML5 Boilerplate Initializr AngularJS Mobile Boilerplate
  28. 28. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1331Javascript Editor Code Completion Contexto de Execução Debug com Chrome Browser log
  29. 29. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1332Instalando o Chrome Extension do NetBeans Instalação Offline
  30. 30. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1334
  31. 31. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1335Implementação de Referência do Java EEdownload.java.net/glassfish/4.0/promoted/GlassFish4.0
  32. 32. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1336Adopt a JSR JUGs participando ativamente Promovendo as JSRs– Para a comunidade Java– Revendo specs– Testando betas e códigos de exemplo– Examplos, docs, bugs– Blogging, palestrando, reuniões de JUG
  33. 33. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1337Adopt a JSRJUGs Participantes
  34. 34. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1338E o futuro Java EE 8? Arquitetura Cloud Multi tenancy para aplicaçõesSaaS Entrega incremental de JSRs Modularidade baseada no JigsawJava EE 8PaaSEnablementMultitenancyNoSQLJSON-BModularityCloudStorageThin ServerArchitectureCloud Programming Model
  35. 35. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1340Participe hoje mesmo! GlassFish 4.0 Java EE 7 RI – http://www.glassfish.org Java EE Expert Group – http://javaee-spec.java.net Adopt a JSR – http://glassfish.org/adoptajsr The Aquarium (GF Blog) – http://blogs.oracle.com/theaquarium NetBeans e Java EE 7 – http://wiki.netbeans.org/JavaEE7 Java EE 7 HOL – http://www.glassfish.org/hol
  36. 36. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1341Perguntas?
  37. 37. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1342OBRIGADO!@brunoborgesblogs.oracle.com/brunoborges
  38. 38. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1343The preceding is intended to outline our general product direction. It is intendedfor information purposes only, and may not be incorporated into any contract.It is not a commitment to deliver any material, code, or functionality, and shouldnot be relied upon in making purchasing decisions. The development, release,and timing of any features or functionality described for Oracle’s productsremains at the sole discretion of Oracle.
  39. 39. Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1344

×