SlideShare a Scribd company logo
Java EE 7: Novidades e
Mudanças
Bruno Borges
Oracle Product Manager
Java Evangelist
@brunoborges
2Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Bruno Borges
Oracle Product Manager / Evangelist
Desenvolvedor, Gamer
Entusiasta em Java Embedded e
JavaFX
Twitter: @brunoborges

3Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Java EE 7
- Produtividade
- Suporte HTML5
- Funcionalidades Enterprise
Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Concurrency 1.0

Interceptors 1.2

Bean Validation 1.1

CDI 1.1

Java EE 7
JSP 2.3
JSTL

EL 3.0

Servlet 3.1

Web Socket 1.0

JAX-RS 2.0
JSON-P 1.0
Batch 1.0

JTA 1.2

EJB 3.2
JPA 2.1
Java EE 7

5Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

JSF 2.2

Insert Information Protection Policy Classification from Slide 13

JMS 2.0

JavaMail 1.5
JCA 1.7
Java EE 7 Web Profile

 Web Profile atualizado para incluir:
–

JAX-RS

–

WebSocket

–

JSON-P

–

EJB 3.2 Lite

6Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Construindo aplicações HTML5

 WebSocket 1.0
 JAX-RS 2.0
 JavaServer Faces 2.2
 JSON-P API

7Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
HTTP vs WebSockets

 Protocolo HTTP é half-duplex
 Gambiarras
–

Polling

–

Long polling

–

Streaming

 WebSocket resolve o problema

de uma vez por todas
–

Full-duplex

8Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
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

9Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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

Insert Information Protection Policy Classification from Slide 13
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;
    }
}

11Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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

Insert Information Protection Policy Classification from Slide 13
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

13Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
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);

14Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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

Insert Information Protection Policy Classification from Slide 13
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

16Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
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, ...

17Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JSON API 1.0

"phoneNumber": [
{
"type": "home",
"number": ”408-123-4567”
},
{
"type": ”work",
"number": ”408-987-6543”
}
]

18Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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();

Insert Information Protection Policy Classification from Slide 13
JavaServer Faces 2.2

19Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JavaServer Faces 2.2

●
●
●
●

Faces Flow
Resource Library Contracts
Multi-templating
HTML5 Friendly Markup Support
– Pass through attributes and elements

●
●
●

Cross Site Request Forgery Protection
Loading Facelets via ResourceHandler
File Upload Component

20Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JavaServer Faces 2.2 – HTML5 Friendly Markup
file:///home/bruno/project/web/myPage.xhtml

<form jsf:id="form" jsf:prependId="false">
<label jsf:for="name">Name < /label>
<input jsf:id="name" type="text" jsf:value="#{complex.name}" />
<label jsf:for="tel">Tel < /label>
<input jsf:id="tel" type="tel" jsf:value="#{complex.tel}" />
<label jsf:for="email">Email < /label>
<input jsf:id="email" type="email" jsf:value="#{complex.email}" />
<label for="progress">Progress < /label>
<progress jsf:id="progress" max="3">
#{complex.progress} of 3
</progress>
</form>
21Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JavaServer Faces 2.2

 Flow Faces

22Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JavaServer Faces 2.2 – Flow Faces
<j:faces-flow-definition>
 
<j:initializer>#{someBean.init}</j:initializer>
<j:start-node>startNode</j:start-node>
 
<j:switch id="startNode">
<j:navigation-case>
<j:if>#{someBean.someCondition}</j:if>
<j:from-outcome>fooView</j:from-outcome>
</j:navigation-case>
</j:switch>
 
<j:view id="barFlow">
<j:vdl-document>barFlow.xhtml</j:vdl-document>
</j:view>
<j:view id="fooView">
<j:vdl-document>create-customer.xhtml</j:vdl-document>
</j:view>
</j:faces-flow-definition>

23Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JavaServer Faces 2.2

 Multi-Templating
–

Seleção default

–

Seleção dinâmica

<ui:composition template="#{userBean.template}">

24Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
JMS para Mensageria

25Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Java Message Service API 2.0

 Simplificação da JMS API 1.1 sem quebrar compatibilidade
 Nova API requer menos objetos
–

JMSContext, JMSProducer...

 No Java EE, permite que JMSContext seja injetado e gerenciado

pelo container, usando CDI
 Objetos JMS implementam AutoCloseable
 Envio Async de mensagens

26Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Java Message Service API 2.0

 JMSContext
 Encapsula Connection e Session
 Criado a partir de um default ConnectionFactory
–

Permite especificar um ConnectionFactory também

 Unchecked exceptions
 Suporta encadeamento de métodos, para fluid style

27Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Java Message Service API 2.0
@Resource(lookupName =
“java:comp/defaultJMSConnectionFactory”)
ConnectionFactory myJMScf;
@Resource(lookupName = “jms/inboud”)
private Queue inboundQueue;
@Inject
@JMSConnectionFactory(“jms/myCF”)
private JMSContext context;
28Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Java Message Service API 2.0
@JMSConnectionFactoryDefinition(
name=”java:global/jms/demoCF”
className = “javax.jms.ConnectionFactory”)
@JMSDestinationDefinition(
name = “java:global/jms/inboudQueue”
className = “javax.jms.Queue”
destinationName = “inboundQueue”)

29Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Message Driven Beans para JMS 2.0
@MessageDriven(
mappedName = “jms/myQueue”,
activationConfig = {
@ActivationConfigProperty(
propertyName = “destinationLookup”,
propertyValue = “jms/myQueue”),
@ActivationConfigProperty(
propertyName = “connectionFactoryLookup”,
propertyValue = “jms/myCF”)
})
30Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Bean Validation
Batch API
Concurrency Utilities

31Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Bean Validation 1.1
public void placeOrder(
@NotNull String productName,
@NotNull @Max(“10”) Integer quantity,
@Customer String customer) {
//. . .
}
@Future
public Date getAppointment() {
//. . .
}

32Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Batch API 1.0
<job id=“myJob”>
<step id=“init”>
<chunk reader=“R” writer=W” processor=“P” />
<next on=“initialized” to=“process”/>
<fail on=“initError”/>
</step>
<step id=“process”>
<batchlet ref=“ProcessAndEmail”/>
<end on=”success”/>
<fail on=”*” exit-status=“FAILURE”/>
</step>
</job>

33Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Batch Applications 1.0
Job Specification Language – Chunked Step
<step id=”sendStatements”>
…implements ItemReader {
<chunk reader ref=”accountReader” public Object readItem() {
processor ref=”accountProcessor”
// read account using JPA
writer ref=”emailWriter”
}
chunk-size=”10” />
</step>
…implements ItemProcessor {
Public Object processItems(Object account) {
// read Account, return Statement
}
…implements ItemWriter {
public void writeItems(List accounts) {
// use JavaMail to send email
}
34Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Concurrency Utilities for Java EE 1.0
●

Provide asynchronous capabilities to Java EE
application components
–

●

●

Without compromising container integrity

Extension of Java SE Concurrency Utilities API (JSR
166)
Support simple (common) and advanced concurrency
patterns

35Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Concurrency Utilities for Java EE 1.0
●

Provide 4 managed objects
–
–

●

ManagedThreadFactory

–

●

ManagedScheduledExecutorService

–

●

ManagedExecutorService

ContextService

Context propagation
Task event notifications
Transactions

36Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Concurrency Utilities for Java EE 1.0
Submit Tasks to ManagedExecutorService using JNDI
public class TestServlet extends HTTPServlet {
@Resource(name=“concurrent/BatchExecutor”)
ManagedExecutorService executor;
Future future = executor.submit(new MyTask());
class MyTask implements Runnable {
public void run() {
. . . // task logic
}
}
}

37Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
NetBeans e o suporte
ao HTML5

38Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
NetBeans 7.3

39Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
HTML5 Wizard

 Twitter Bootstrap
 HTML5 Boilerplate
 Initializr
 AngularJS
 Mobile Boilerplate

40Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Javascript Editor

 Code Completion
 Contexto de Execução
 Debug com Chrome
 Browser log

41Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Instalando o Chrome Extension do NetBeans

 Instalação Offline

42Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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

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

Insert Information Protection Policy Classification from Slide 13
Java EE nas Redes Sociais

Twitter

@java_ee

Facebook facebook.com/javaeeplatform
Google+

45Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

gplus.to/JavaEE

Insert Information Protection Policy Classification from Slide 13
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

46Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
Adopt a JSR
JUGs Participantes

47Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
E o futuro do Java EE 8?
Cloud Programming Model
Storage
JSON-B

 Arquitetura Cloud
 Multi tenancy para aplicações

SaaS
 Entrega incremental de JSRs
 Modularidade baseada no Jigsaw
 glassfish.org/survey

48Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13

Modularity

NoSQL
Multitenancy

Java EE 8
Cloud
PaaS
Enablement

Thin Server
Architecture
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

49Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
OBRIGADO!
@brunoborges
blogs.oracle.com/brunoborges

50Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Insert Information Protection Policy Classification from Slide 13
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.

51Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

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

Insert Information Protection Policy Classification from Slide 13

More Related Content

Similar to Java EE 7 - Novidades e Mudanças (20)

PDF
Aplicações HTML5 com Java EE 7 e NetBeans
Bruno Borges
 
PDF
As novidades do Java EE 7: do HTML5 ao JMS 2.0
Bruno Borges
 
PPTX
A Importância do JavaFX no Mercado Embedded
Bruno Borges
 
PDF
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
jaxLondonConference
 
PDF
Java EE 7: Boosting Productivity and Embracing HTML5
Arun Gupta
 
PPTX
JavaFX and JEE 7
Vijay Nair
 
PDF
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Max Andersen
 
PPTX
Java ee7 1hour
Frank Rodriguez
 
PDF
Batch Applications for the Java Platform
Sivakumar Thyagarajan
 
PPTX
Java EE7
Jay Lee
 
PDF
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Arun Gupta
 
PDF
Introduction to JavaFX on Raspberry Pi
Bruno Borges
 
PPT
GlassFish BOF
glassfish
 
PDF
OTN Tour 2013: What's new in java EE 7
Bruno Borges
 
PDF
Novidades do Java SE 8
Bruno Borges
 
PDF
Java EE7 Demystified
Ankara JUG
 
PPTX
whats-new-netbeans-ide-80.pptx
GabrielSoche
 
PDF
Con5133
Roger Kitain
 
PDF
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
DataGeekery
 
PDF
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
Shing Wai Chan
 
Aplicações HTML5 com Java EE 7 e NetBeans
Bruno Borges
 
As novidades do Java EE 7: do HTML5 ao JMS 2.0
Bruno Borges
 
A Importância do JavaFX no Mercado Embedded
Bruno Borges
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
jaxLondonConference
 
Java EE 7: Boosting Productivity and Embracing HTML5
Arun Gupta
 
JavaFX and JEE 7
Vijay Nair
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Max Andersen
 
Java ee7 1hour
Frank Rodriguez
 
Batch Applications for the Java Platform
Sivakumar Thyagarajan
 
Java EE7
Jay Lee
 
Java API for WebSocket 1.0: Java EE 7 and GlassFish
Arun Gupta
 
Introduction to JavaFX on Raspberry Pi
Bruno Borges
 
GlassFish BOF
glassfish
 
OTN Tour 2013: What's new in java EE 7
Bruno Borges
 
Novidades do Java SE 8
Bruno Borges
 
Java EE7 Demystified
Ankara JUG
 
whats-new-netbeans-ide-80.pptx
GabrielSoche
 
Con5133
Roger Kitain
 
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
DataGeekery
 
JavaOne Shanghai 2013 - Servlet 3.1 (JSR 340)
Shing Wai Chan
 

More from Bruno Borges (20)

PDF
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
PDF
[Outdated] Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
PDF
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
Bruno Borges
 
PDF
Making Sense of Serverless Computing
Bruno Borges
 
PPTX
Visual Studio Code for Java and Spring Developers
Bruno Borges
 
PDF
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Bruno Borges
 
PDF
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
Bruno Borges
 
PPTX
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Bruno Borges
 
PPTX
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Bruno Borges
 
PPTX
Java EE Arquillian Testing with Docker & The Cloud
Bruno Borges
 
PPTX
Migrating From Applets to Java Desktop Apps in JavaFX
Bruno Borges
 
PDF
Servidores de Aplicação: Por quê ainda precisamos deles?
Bruno Borges
 
PDF
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Bruno Borges
 
PDF
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Bruno Borges
 
PDF
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Bruno Borges
 
PDF
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Bruno Borges
 
PDF
Running Oracle WebLogic on Docker Containers [BOF7537]
Bruno Borges
 
PPTX
Lightweight Java in the Cloud
Bruno Borges
 
PDF
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Bruno Borges
 
PDF
Integrando Oracle BPM com Java EE e WebSockets
Bruno Borges
 
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
Bruno Borges
 
Making Sense of Serverless Computing
Bruno Borges
 
Visual Studio Code for Java and Spring Developers
Bruno Borges
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Bruno Borges
 
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
Bruno Borges
 
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Bruno Borges
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Bruno Borges
 
Java EE Arquillian Testing with Docker & The Cloud
Bruno Borges
 
Migrating From Applets to Java Desktop Apps in JavaFX
Bruno Borges
 
Servidores de Aplicação: Por quê ainda precisamos deles?
Bruno Borges
 
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Bruno Borges
 
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Bruno Borges
 
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Bruno Borges
 
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Bruno Borges
 
Running Oracle WebLogic on Docker Containers [BOF7537]
Bruno Borges
 
Lightweight Java in the Cloud
Bruno Borges
 
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Bruno Borges
 
Integrando Oracle BPM com Java EE e WebSockets
Bruno Borges
 
Ad

Recently uploaded (20)

PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Ad

Java EE 7 - Novidades e Mudanças

  • 1. Java EE 7: Novidades e Mudanças Bruno Borges Oracle Product Manager Java Evangelist @brunoborges 2Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 2. Bruno Borges Oracle Product Manager / Evangelist Desenvolvedor, Gamer Entusiasta em Java Embedded e JavaFX Twitter: @brunoborges 3Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 3. Java EE 7 - Produtividade - Suporte HTML5 - Funcionalidades Enterprise Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 4. Concurrency 1.0 Interceptors 1.2 Bean Validation 1.1 CDI 1.1 Java EE 7 JSP 2.3 JSTL EL 3.0 Servlet 3.1 Web Socket 1.0 JAX-RS 2.0 JSON-P 1.0 Batch 1.0 JTA 1.2 EJB 3.2 JPA 2.1 Java EE 7 5Copyright © 2012, Oracle and/or its affiliates. All rights reserved. JSF 2.2 Insert Information Protection Policy Classification from Slide 13 JMS 2.0 JavaMail 1.5 JCA 1.7
  • 5. Java EE 7 Web Profile  Web Profile atualizado para incluir: – JAX-RS – WebSocket – JSON-P – EJB 3.2 Lite 6Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 6. Construindo aplicações HTML5  WebSocket 1.0  JAX-RS 2.0  JavaServer Faces 2.2  JSON-P API 7Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 7. HTTP vs WebSockets  Protocolo HTTP é half-duplex  Gambiarras – Polling – Long polling – Streaming  WebSocket resolve o problema de uma vez por todas – Full-duplex 8Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 8. 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 9Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 9. 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 10Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 10. 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;     } } 11Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 11. 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));     } } 12Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 12. 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 13Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 13. 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); 14Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 14. 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); }}); } } 15Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 15. 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 16Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 16. 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, ... 17Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 17. JSON API 1.0 "phoneNumber": [ { "type": "home", "number": ”408-123-4567” }, { "type": ”work", "number": ”408-987-6543” } ] 18Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 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(); Insert Information Protection Policy Classification from Slide 13
  • 18. JavaServer Faces 2.2 19Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 19. JavaServer Faces 2.2 ● ● ● ● Faces Flow Resource Library Contracts Multi-templating HTML5 Friendly Markup Support – Pass through attributes and elements ● ● ● Cross Site Request Forgery Protection Loading Facelets via ResourceHandler File Upload Component 20Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 20. JavaServer Faces 2.2 – HTML5 Friendly Markup file:///home/bruno/project/web/myPage.xhtml <form jsf:id="form" jsf:prependId="false"> <label jsf:for="name">Name < /label> <input jsf:id="name" type="text" jsf:value="#{complex.name}" /> <label jsf:for="tel">Tel < /label> <input jsf:id="tel" type="tel" jsf:value="#{complex.tel}" /> <label jsf:for="email">Email < /label> <input jsf:id="email" type="email" jsf:value="#{complex.email}" /> <label for="progress">Progress < /label> <progress jsf:id="progress" max="3"> #{complex.progress} of 3 </progress> </form> 21Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 21. JavaServer Faces 2.2  Flow Faces 22Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 22. JavaServer Faces 2.2 – Flow Faces <j:faces-flow-definition>   <j:initializer>#{someBean.init}</j:initializer> <j:start-node>startNode</j:start-node>   <j:switch id="startNode"> <j:navigation-case> <j:if>#{someBean.someCondition}</j:if> <j:from-outcome>fooView</j:from-outcome> </j:navigation-case> </j:switch>   <j:view id="barFlow"> <j:vdl-document>barFlow.xhtml</j:vdl-document> </j:view> <j:view id="fooView"> <j:vdl-document>create-customer.xhtml</j:vdl-document> </j:view> </j:faces-flow-definition> 23Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 23. JavaServer Faces 2.2  Multi-Templating – Seleção default – Seleção dinâmica <ui:composition template="#{userBean.template}"> 24Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 24. JMS para Mensageria 25Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 25. Java Message Service API 2.0  Simplificação da JMS API 1.1 sem quebrar compatibilidade  Nova API requer menos objetos – JMSContext, JMSProducer...  No Java EE, permite que JMSContext seja injetado e gerenciado pelo container, usando CDI  Objetos JMS implementam AutoCloseable  Envio Async de mensagens 26Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 26. Java Message Service API 2.0  JMSContext  Encapsula Connection e Session  Criado a partir de um default ConnectionFactory – Permite especificar um ConnectionFactory também  Unchecked exceptions  Suporta encadeamento de métodos, para fluid style 27Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 27. Java Message Service API 2.0 @Resource(lookupName = “java:comp/defaultJMSConnectionFactory”) ConnectionFactory myJMScf; @Resource(lookupName = “jms/inboud”) private Queue inboundQueue; @Inject @JMSConnectionFactory(“jms/myCF”) private JMSContext context; 28Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 28. Java Message Service API 2.0 @JMSConnectionFactoryDefinition( name=”java:global/jms/demoCF” className = “javax.jms.ConnectionFactory”) @JMSDestinationDefinition( name = “java:global/jms/inboudQueue” className = “javax.jms.Queue” destinationName = “inboundQueue”) 29Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 29. Message Driven Beans para JMS 2.0 @MessageDriven( mappedName = “jms/myQueue”, activationConfig = { @ActivationConfigProperty( propertyName = “destinationLookup”, propertyValue = “jms/myQueue”), @ActivationConfigProperty( propertyName = “connectionFactoryLookup”, propertyValue = “jms/myCF”) }) 30Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 30. Bean Validation Batch API Concurrency Utilities 31Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 31. Bean Validation 1.1 public void placeOrder( @NotNull String productName, @NotNull @Max(“10”) Integer quantity, @Customer String customer) { //. . . } @Future public Date getAppointment() { //. . . } 32Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 32. Batch API 1.0 <job id=“myJob”> <step id=“init”> <chunk reader=“R” writer=W” processor=“P” /> <next on=“initialized” to=“process”/> <fail on=“initError”/> </step> <step id=“process”> <batchlet ref=“ProcessAndEmail”/> <end on=”success”/> <fail on=”*” exit-status=“FAILURE”/> </step> </job> 33Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 33. Batch Applications 1.0 Job Specification Language – Chunked Step <step id=”sendStatements”> …implements ItemReader { <chunk reader ref=”accountReader” public Object readItem() { processor ref=”accountProcessor” // read account using JPA writer ref=”emailWriter” } chunk-size=”10” /> </step> …implements ItemProcessor { Public Object processItems(Object account) { // read Account, return Statement } …implements ItemWriter { public void writeItems(List accounts) { // use JavaMail to send email } 34Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 34. Concurrency Utilities for Java EE 1.0 ● Provide asynchronous capabilities to Java EE application components – ● ● Without compromising container integrity Extension of Java SE Concurrency Utilities API (JSR 166) Support simple (common) and advanced concurrency patterns 35Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 35. Concurrency Utilities for Java EE 1.0 ● Provide 4 managed objects – – ● ManagedThreadFactory – ● ManagedScheduledExecutorService – ● ManagedExecutorService ContextService Context propagation Task event notifications Transactions 36Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 36. Concurrency Utilities for Java EE 1.0 Submit Tasks to ManagedExecutorService using JNDI public class TestServlet extends HTTPServlet { @Resource(name=“concurrent/BatchExecutor”) ManagedExecutorService executor; Future future = executor.submit(new MyTask()); class MyTask implements Runnable { public void run() { . . . // task logic } } } 37Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 37. NetBeans e o suporte ao HTML5 38Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 38. NetBeans 7.3 39Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 39. HTML5 Wizard  Twitter Bootstrap  HTML5 Boilerplate  Initializr  AngularJS  Mobile Boilerplate 40Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 40. Javascript Editor  Code Completion  Contexto de Execução  Debug com Chrome  Browser log 41Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 41. Instalando o Chrome Extension do NetBeans  Instalação Offline 42Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 42. Q&A 43Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 43. 44Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 44. Java EE nas Redes Sociais Twitter @java_ee Facebook facebook.com/javaeeplatform Google+ 45Copyright © 2012, Oracle and/or its affiliates. All rights reserved. gplus.to/JavaEE Insert Information Protection Policy Classification from Slide 13
  • 45. 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 46Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 46. Adopt a JSR JUGs Participantes 47Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 47. E o futuro do Java EE 8? Cloud Programming Model Storage JSON-B  Arquitetura Cloud  Multi tenancy para aplicações SaaS  Entrega incremental de JSRs  Modularidade baseada no Jigsaw  glassfish.org/survey 48Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 Modularity NoSQL Multitenancy Java EE 8 Cloud PaaS Enablement Thin Server Architecture
  • 48. 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 49Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 49. OBRIGADO! @brunoborges blogs.oracle.com/brunoborges 50Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 50. 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. 51Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13
  • 51. 52Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13