Download - Aplicações HTML5 com Java EE 7 e NetBeans
![Page 1: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/1.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132
Aplicações HTML5 com Java EE 7 e NetBeans
Bruno BorgesOracle Product ManagerJava Evangelist@brunoborges
![Page 2: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/2.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 133
Bruno Borges
Oracle Product Manager / Evangelist
Desenvolvedor, Gamer
Entusiasta em Java Embedded e JavaFX
Twitter: @brunoborges
![Page 3: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/3.jpg)
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 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
![Page 4: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/4.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 135
Plataforma Java EE 610 Dezembro, 2009
![Page 5: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/5.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 136
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
![Page 6: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/6.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 137
Top Ten Features no Java EE 6
1. 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
![Page 7: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/7.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 138
Java EE 7está pronto!
![Page 8: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/8.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 139
IntroducingJava EE 7 Live Webcast
http://bit.ly/javaee7launch
![Page 9: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/9.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1310
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
![Page 10: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/10.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1311
Java EE 7
EJB 3.2
Servlet 3.1
CDIExtensio
ns
Batch 1.0
Web Fragment
s
JCA 1.7JMS 2.0JPA 2.1
Managed Beans 1.0
Concurrency 1.0Common
Annotations 1.1Interceptors1.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
WebSocket 1.0
![Page 11: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/11.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1313
Java EE 7 Web Profile
Web Profile updated to include– JAX-RS
– WebSocket
– JSON-P
– EJB 3.2 Lite
Outras APIs
![Page 12: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/12.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1314
Construindo aplicações HTML5
WebSocket 1.0 JAX-RS 2.0 JavaServer Faces 2.2 JSON-P API
![Page 13: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/13.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1315
HTTP vs WebSockets
Protocolo HTTP é half-duplex Gambiarras
– Polling
– Long polling
– Streaming
WebSocket resolve o problemade uma vez por todas
– Full-duplex
![Page 14: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/14.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1316
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
![Page 15: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/15.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1317
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
![Page 16: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/16.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1318
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; }}
![Page 17: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/17.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1319
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)); }}
![Page 18: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/18.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1321
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
![Page 19: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/19.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1322
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
![Page 20: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/20.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1323
JAX-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);
![Page 21: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/21.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1324
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); }}); }}
![Page 22: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/22.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1325
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
![Page 23: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/23.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1326
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, ...
![Page 24: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/24.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1327
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();
![Page 25: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/25.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1328
NetBeans e o suporte ao HTML5
![Page 26: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/26.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1329
NetBeans 7.3
![Page 27: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/27.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1330
HTML5 Wizard
Twitter Bootstrap HTML5 Boilerplate Initializr AngularJS Mobile Boilerplate
![Page 28: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/28.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1331
Javascript Editor
Code Completion Contexto de Execução Debug com Chrome Browser log
![Page 29: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/29.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1332
Instalando o Chrome Extension do NetBeans
Instalação Offline
![Page 30: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/30.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1334
![Page 31: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/31.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1335
Implementação de Referência do Java EE
download.java.net/glassfish/4.0/promoted/
GlassFish 4.0
![Page 32: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/32.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1336
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
![Page 33: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/33.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1337
Adopt a JSRJUGs Participantes
![Page 34: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/34.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1338
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
PaaSEnablement
Multitenancy
NoSQL
JSON-B
ModularityCloud
Storage
Thin ServerArchitecture
Cloud Programming Model
![Page 35: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/35.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1340
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
![Page 36: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/36.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1341
Perguntas?
![Page 37: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/37.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1342
[email protected]/brunoborges
![Page 38: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/38.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1343
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.
![Page 39: Aplicações HTML5 com Java EE 7 e NetBeans](https://reader033.vdocuments.net/reader033/viewer/2022051014/54b6bff84a795964218b4582/html5/thumbnails/39.jpg)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1344