Slide 1

Slide 1 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 2 Aplicações HTML5 com Java EE 7 e NetBeans Bruno Borges Oracle Product Manager Java Evangelist @brunoborges

Slide 2

Slide 2 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 3 Bruno Borges Oracle Product Manager / Evangelist Desenvolvedor, Gamer Entusiasta em Java Embedded e JavaFX Twitter: @brunoborges

Slide 3

Slide 3 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 4Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16 Agenda  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

Slide 4

Slide 4 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 5 Plataforma Java EE 6 10 Dezembro, 2009

Slide 5

Slide 5 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 6 Java 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

Slide 6

Slide 6 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 7 Top Ten Features no Java EE 6 1. Empacotar EJB dentro de um WAR 2. Injeção de Dependência Type-safe 3. Deployment descriptors opcionais (web.xml, faces-config.xml) 4. JSF padronizado com Facelets 5. Uma única classe por EJB 6. Extensões de Servlet e CDI 7. CDI Events 8. EJBContainer API 9. Agendamento estilo Cron com @Schedule 10. Web Profile

Slide 7

Slide 7 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 8 Java EE 7 está pronto!

Slide 8

Slide 8 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 9 Introducing Java EE 7 Live Webcast http://bit.ly/javaee7launch

Slide 9

Slide 9 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 10 Java EE 7 Escopo ● Produtividade de Desenvolvimento – Menos código Boilerplate – Funcionalidades mais ricas – Mais convenções e defaults ● Suporte a HTML5 – WebSocket – JSON – HTML5 Forms JSR 342

Slide 10

Slide 10 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 11 Java EE 7 EJB 3.2 Servlet 3.1 CDI Extensio ns Batch 1.0 Web Fragment s JCA 1.7 JMS 2.0 JPA 2.1 Managed Beans 1.0 Concurrency 1.0 Common Annotations 1.1 Interceptors 1.2, JTA 1.2 CDI 1.1 JSF 2.2, JSP 2.3, EL 3.0 JAX-RS 2.0, JAX-WS 2.2 JSON 1.0 WebSock et 1.0

Slide 11

Slide 11 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 13 Java EE 7 Web Profile  Web Profile updated to include – JAX-RS – WebSocket – JSON-P – EJB 3.2 Lite  Outras APIs

Slide 12

Slide 12 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 14 Construindo aplicações HTML5  WebSocket 1.0  JAX-RS 2.0  JavaServer Faces 2.2  JSON-P API

Slide 13

Slide 13 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 15 HTTP vs WebSockets  Protocolo HTTP é half-duplex  Gambiarras – Polling – Long polling – Streaming  WebSocket resolve o problema de uma vez por todas – Full-duplex

Slide 14

Slide 14 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 16 WebSockets Handshake  Cliente solicita um UPGRADE  Server confirma (Servlet 3.1)  Cliente recebe o OK  Inicia a sessão WebSocket http://farata.github.io/slidedecks/state_of_websocket/slides.html#13.4

Slide 15

Slide 15 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 17 Java 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

Slide 16

Slide 16 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 18 Java API for WebSockets 1.0 import javax.websocket.*; import javax.websocket.server.*; @ServerEndpoint(“/hello”) public class HelloBean { @OnMessage public String sayHello(String name) { return “Hello “ + name; } }

Slide 17

Slide 17 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 19 Java 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)); } }

Slide 18

Slide 18 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 21 Maven 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

Slide 19

Slide 19 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 22 JAX-RS 2.0  Client API  Message Filters & Entity Interceptors  Asynchronous Processing – Server & Client  Suporte Hypermedia  Common Configuration – Compartilhar configuração comum entre diversos serviços REST

Slide 20

Slide 20 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 23 JAX-RS 2.0 - Client // Get instance of Client Client client = ClientFactory.getClient(); // Get customer name for the shipped products String name = client.target(“http://.../orders/{orderId}/customer”) .resolveTemplate(“orderId”, “10”) .queryParam(“shipped”, “true)” .request() .get(String.class);

Slide 21

Slide 21 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 24 JAX-RS 2.0 - Server @Path("/async/longRunning") public class MyResource { @GET public void longRunningOp(@Suspended AsyncResponse ar) { ar.setTimeoutHandler(new MyTimoutHandler()); ar.setTimeout(15, SECONDS); Executors.newSingleThreadExecutor().submit(new Runnable() { public void run() { ... ar.resume(result); }}); } }

Slide 22

Slide 22 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 25 JavaServer Faces 2.2  Flow Faces  HTML5 Friendly Markup  Cross-site Request Forgery Protection  Carregamento de Facelets via ResourceHandler  Componente de File Upload  Multi-templating

Slide 23

Slide 23 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 26 JSON 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, ...

Slide 24

Slide 24 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 27 JSON 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();

Slide 25

Slide 25 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 28 NetBeans e o suporte ao HTML5

Slide 26

Slide 26 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 29 NetBeans 7.3

Slide 27

Slide 27 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 30 HTML5 Wizard  Twitter Bootstrap  HTML5 Boilerplate  Initializr  AngularJS  Mobile Boilerplate

Slide 28

Slide 28 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 31 Javascript Editor  Code Completion  Contexto de Execução  Debug com Chrome  Browser log

Slide 29

Slide 29 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 32 Instalando o Chrome Extension do NetBeans  Instalação Offline

Slide 30

Slide 30 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 34

Slide 31

Slide 31 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 35 Implementação de Referência do Java EE download.java.net/glassfish/4.0/promoted/ GlassFish 4.0

Slide 32

Slide 32 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 36 Adopt 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

Slide 33

Slide 33 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 37 Adopt a JSR JUGs Participantes

Slide 34

Slide 34 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 38 E o futuro Java EE 8?  Arquitetura Cloud  Multi tenancy para aplicações SaaS  Entrega incremental de JSRs  Modularidade baseada no Jigsaw Java EE 8 PaaS Enablement Multitenancy NoSQL JSON-B Modularity Cloud Storage Thin Server Architecture Cloud Programming Model

Slide 35

Slide 35 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 40 Participe 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

Slide 36

Slide 36 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 41 Perguntas?

Slide 37

Slide 37 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 42 OBRIGADO! @brunoborges blogs.oracle.com/brunoborges

Slide 38

Slide 38 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 43 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.

Slide 39

Slide 39 text

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 44