SlideShare a Scribd company logo
1 of 34
Download to read offline
The Java EE 7 Platform
Productivity++ and HTML5
Arun Gupta
Director, Developer Advocacy, Red Hat
blog.arungupta.me, @arungupta

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

Insert Picture Here
Java: Broadest Industry Adoption

9,000,000
JAVA DEVELOPERS
DEPLOYING TO 18 COMPLIANT APPLICATION SERVERS

2Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java EE 7 Platform
Jun 12, 2013

3Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java EE 7 Themes
ENTERPRISE EDITION

MEETING
ENTERPRISE
DEMANDS

DEVELOPER
PRODUCTIVITY
Java EE 7

 More annotated POJOs
 Less boilerplate code
 Cohesive integrated
platform

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






WebSockets
JSON
Servlet 3.1 NIO
REST

 Batch
 Concurrency
 Simplified JMS
Top Ten Features in Java EE 7
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

WebSocket client/server endpoints
Batch Applications
JSON Processing
Concurrency Utilities
Simplified JMS API
@Transactional and @TransactionScoped
JAX-RS Client API
Default Resources
More annotated POJOs
Faces Flow

5Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java API for WebSocket 1.0
Server and Client WebSocket Endpoint
Annotated: @ServerEndpoint, @ClientEndpoint
Programmatic: Endpoint

Lifecycle methods
Packaging and Deployment

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

@ServerEndpoint(“/chat”)
public class ChatServer {
@OnMessage
public void chat(String m) {
. . .
}
}
Java API for WebSocket 1.0
Chat Server
@ServerEndpoint("/chat")
public class ChatBean {
static Set<Session> peers = Collections.synchronizedSet(…);
@OnOpen
public void onOpen(Session peer) {
peers.add(peer);
}
@OnClose
public void onClose(Session peer) {
peers.remove(peer);
}
. . .

7Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java API for WebSocket 1.0
Chat Server (contd.)
. . .
@OnMessage
public void message(String message) {
for (Session peer : peers) {
peer.getRemote().sendObject(message);
}
}
}

8Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JSON Processing 1.0
API to parse and generate JSON
Streaming API
● Low-level, efficient way to parse/generate JSON
● Similar to StAX API in XML world

Object Model API
● Simple, easy to use high-level API
● Similar to DOM API in XML world

9Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java API for JSON Processing 1.0
Streaming API

{
"firstName": "John", "lastName": "Smith", "age": 25,
"phoneNumber": [
{ "type": "home", "number": "212 555-1234" },
{ "type": "fax", "number": "646 555-4567" }
]
}
JsonParser p = Json.createParser(…);
JsonParser.Event event = p.next();
event = p.next();
event = p.next();
String name = p.getString();
10Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

// START_OBJECT
// KEY_NAME
// VALUE_STRING
// "John”
Batch Applications for Java Platform 1.0
Suited for non-interactive, bulk-oriented, and long-running tasks
Batch execution: sequential, parallel, decision-based
Processing Styles
● Item-oriented: Chunked (primary)
● Task-oriented: Batchlet

11Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Batch Applications 1.0
Concepts

Batch
process
Manage
batch
process

Independent
sequential
phase of job
Chunk

Metadata for jobs

12Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Batch Applications 1.0
Chunked Job Specification

<step id=”sendStatements”>
…implements ItemReader {
<chunk item-count=“3”>
public Object readItem() {
<reader ref=”accountReader”/>
// read account using JPA
<processor ref=”accountProcessor”/>
}
<writer ref=”emailWriter”/>
</step>
…implements ItemProcessor {
Public Object processItems(Object account) {
// read Account, return Statement
}
…implements ItemWriter {
public void writeItems(List accounts) {
// use JavaMail to send email
}
13Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Concurrency Utilities for Java EE 1.0
Extension of Java SE Concurrency Utilities API
Provide asynchronous capabilities to Java EE application components
Provides 4 types of managed objects
● ManagedExecutorService
● ManagedScheduledExecutorService
● ManagedThreadFactory
● ContextService

Context Propagation

14Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Concurrency Utilities for Java EE 1.0
Submit Tasks to ManagedExecutorService using JNDI

public class TestServlet extends HttpPServlet {
@Resource(name=“java:comp/DefaultManagedExecutorService”)
ManagedExecutorService executor;
Future future = executor.submit(new MyTask());
class MyTask implements Runnable {
public void run() {
. . . // task logic
}
}
}

15Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java Message Service 2.0
Get More from Less
Java EE 7

New JMSContext interface
AutoCloseable JMSContext, Connection, Session, …
Use of runtime exceptions
Method chaining on JMSProducer
Simplified message sending

16Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java Message Service 2.0
Sending a Message using JMS 1.1
@Resource(lookup = "myConnectionFactory”)
ConnectionFactory connectionFactory;
@Resource(lookup = "myQueue”)
Queue myQueue;
public void sendMessage (String payload) {
Connection connection = null;
try {
connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(myQueue);
TextMessage textMessage = session.createTextMessage(payload);
messageProducer.send(textMessage);
} catch (JMSException ex) {
//. . .
} finally {
if (connection != null) {
try {
connection.close();
} catch (JMSException ex) {
//. . .
}
}
}
}

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

Application Server
Specific Resources

Boilerplate Code

Exception Handling
Java Message Service 2.0
Sending a Message

@Inject
JMSContext context;
@Resource(lookup = "java:global/jms/demoQueue”)
Queue demoQueue;
public void sendMessage(String payload) {
context.createProducer().send(demoQueue, payload);
}

18Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java API for RESTful Web Services 2.0
Client API
Message Filters and Entity Interceptors
Asynchronous Processing – Server and Client
Common Configuration

19Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java API for RESTful Web Services 2.0
Client API

// Get instance of Client
Client client = ClientBuilder.newClient();
// Get customer name for the shipped products
String name = client.target(“../orders/
{orderId}/customer”)
.resolveTemplate(”orderId", ”10”)
.queryParam(”shipped", ”true”)
.request()
.get(String.class);

20Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Contexts and Dependency Injection 1.1
Automatic enablement for beans with scope annotation and EJBs
“beans.xml” is optional
Bean discovery mode
● all: All types
● annotated: Types with bean defining annotation
● none: Disable CDI
@Vetoed for programmatic disablement of classes
Global ordering/priority of interceptors and decorators
21Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Bean Validation 1.1
Java EE 7

Alignment with Dependency Injection
Method-level validation
Constraints on parameters and return values
● Check pre-/post-conditions
Integration with JAX-RS

22Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Bean Validation 1.1
Method Parameter and Result Validation

public void placeOrder(
@NotNull String productName,
Built-in
@NotNull @Max(“10”) Integer quantity,
@Customer String customer) {
Custom
//. . .
}
@Future
public Date getAppointment() {
//. . .
}
23Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java Persistence API 2.1
Schema Generation
javax.persistence.schema-generation.* properties
Unsynchronized Persistence Contexts
Bulk update/delete using Criteria
User-defined functions using FUNCTION
Stored Procedure Query

24Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Servlet 3.1
Non-blocking I/O
Protocol Upgrade
Security Enhancements
<deny-uncovered-http-methods>: Deny request to HTTP methods not
explicitly covered

25Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Servlet 3.1
Non-blocking I/O Traditional

public class TestServlet extends HttpServlet
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
ServletInputStream input = request.getInputStream();
byte[] b = new byte[1024];
int len = -1;
while ((len = input.read(b)) != -1) {
. . .
}
}
}

26Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Servlet 3.1
Non-blocking I/O: doGet

AsyncContext context = request.startAsync();
ServletInputStream input = request.getInputStream();
input.setReadListener(
new MyReadListener(input, context));

27Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Servlet 3.1
Non-blocking read
@Override
public void onDataAvailable() {
try {
StringBuilder sb = new StringBuilder();
int len = -1;
byte b[] = new byte[1024];
while (input.isReady() && (len = input.read(b)) != -1) {
String data = new String(b, 0, len);
System.out.println("--> " + data);
}
} catch (IOException ex) {
. . .
}
}
. . .

28Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JavaServer Faces 2.2
Faces Flow
Resource Library Contracts
HTML5 Friendly Markup Support
Pass through attributes and elements
Cross Site Request Forgery Protection
Loading Facelets via ResourceHandler
h:inputFile: New File Upload Component

29Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java Transaction API 1.2
@Transactional: Define transaction boundaries on CDI managed
beans
@TransactionScoped: CDI scope for bean instances scoped to the active
JTA transaction

Java EE 7

30Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Java EE 7 JSRs
CDI
Extensions

JSF 2.2,
JSP 2.3,
EL 3.0

Web
Fragments

JAX-RS 2.0,
JAX-WS 2.2

JSON 1.0

WebSocket
1.0

CDI 1.1

Interceptors
1.2, JTA 1.2

Common
Annotations 1.1

EJB 3.2

Managed Beans 1.0

JPA 2.1

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

JMS 2.0

Concurrency 1.0

JCA 1.7

Batch 1.0

Bean Validation 1.1

Servlet 3.1
DOWNLOAD
Java EE 7 SDK
oracle.com/javaee
GlassFish 4.0
Full Platform or Web Profile

glassfish.org

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

wildfly.org/download
33Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Adopt-a-JSR
Participating JUGs

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

More Related Content

What's hot

Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望
javatwo2011
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
knight1128
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
knight1128
 
Java web programming
Java web programmingJava web programming
Java web programming
Ching Yi Chan
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
vikram singh
 

What's hot (20)

Indic threads pune12-java ee 7 platformsimplification html5
Indic threads pune12-java ee 7 platformsimplification html5Indic threads pune12-java ee 7 platformsimplification html5
Indic threads pune12-java ee 7 platformsimplification html5
 
50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes50 new features of Java EE 7 in 50 minutes
50 new features of Java EE 7 in 50 minutes
 
Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望
 
50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes50 New Features of Java EE 7 in 50 minutes
50 New Features of Java EE 7 in 50 minutes
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App Engine
 
Java Enterprise Edition
Java Enterprise EditionJava Enterprise Edition
Java Enterprise Edition
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom TagsJava Web Programming [5/9] : EL, JSTL and Custom Tags
Java Web Programming [5/9] : EL, JSTL and Custom Tags
 
Java Web Programming [9/9] : Web Application Security
Java Web Programming [9/9] : Web Application SecurityJava Web Programming [9/9] : Web Application Security
Java Web Programming [9/9] : Web Application Security
 
Java Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet BasicJava Web Programming [2/9] : Servlet Basic
Java Web Programming [2/9] : Servlet Basic
 
Rapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINARapid Network Application Development with Apache MINA
Rapid Network Application Development with Apache MINA
 
Java9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadJava9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidad
 
Java EE 01-Servlets and Containers
Java EE 01-Servlets and ContainersJava EE 01-Servlets and Containers
Java EE 01-Servlets and Containers
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능Jdk(java) 7 - 6 기타기능
Jdk(java) 7 - 6 기타기능
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Java web programming
Java web programmingJava web programming
Java web programming
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 

Viewers also liked

Getting Started with WebSockets and Server-Sent Events
Getting Started with WebSockets and Server-Sent EventsGetting Started with WebSockets and Server-Sent Events
Getting Started with WebSockets and Server-Sent Events
Arun Gupta
 

Viewers also liked (13)

Getting Started with WebSockets and Server-Sent Events
Getting Started with WebSockets and Server-Sent EventsGetting Started with WebSockets and Server-Sent Events
Getting Started with WebSockets and Server-Sent Events
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
 
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.PilgrimJavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
 
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
2012 04-09-v2-tdp-1167-cdi-bestpractices-final2012 04-09-v2-tdp-1167-cdi-bestpractices-final
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
 
Deploying Web Applications with WildFly 8
Deploying Web Applications with WildFly 8Deploying Web Applications with WildFly 8
Deploying Web Applications with WildFly 8
 
50 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 201450 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 2014
 
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 201450 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
 
CQRS is not Event Sourcing
CQRS is not Event SourcingCQRS is not Event Sourcing
CQRS is not Event Sourcing
 
CDI 1.1 university
CDI 1.1 universityCDI 1.1 university
CDI 1.1 university
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
 
Package your Java EE Application using Docker and Kubernetes
Package your Java EE Application using Docker and KubernetesPackage your Java EE Application using Docker and Kubernetes
Package your Java EE Application using Docker and Kubernetes
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
 

Similar to Java EE 7: Boosting Productivity and Embracing HTML5

Similar to Java EE 7: Boosting Productivity and Embracing HTML5 (20)

Java ee7 1hour
Java ee7 1hourJava ee7 1hour
Java ee7 1hour
 
OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7
 
GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOF
 
Presente e Futuro: Java EE.next()
Presente e Futuro: Java EE.next()Presente e Futuro: Java EE.next()
Presente e Futuro: Java EE.next()
 
As novidades do Java EE 7: do HTML5 ao JMS 2.0
As novidades do Java EE 7: do HTML5 ao JMS 2.0As novidades do Java EE 7: do HTML5 ao JMS 2.0
As novidades do Java EE 7: do HTML5 ao JMS 2.0
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java Platform
 
'New JMS features in GlassFish 4.0' by Nigel Deakin
'New JMS features in GlassFish 4.0' by Nigel Deakin'New JMS features in GlassFish 4.0' by Nigel Deakin
'New JMS features in GlassFish 4.0' by Nigel Deakin
 
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX LondonJAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
 
What's new in Java Message Service 2?
What's new in Java Message Service 2?What's new in Java Message Service 2?
What's new in Java Message Service 2?
 
Java EE 7 overview
Java EE 7 overviewJava EE 7 overview
Java EE 7 overview
 
Getting Started with Java EE 7
Getting Started with Java EE 7Getting Started with Java EE 7
Getting Started with Java EE 7
 
Java EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e MudançasJava EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e Mudanças
 
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
Red Hat and Oracle: Delivering on the Promise of Interoperability in Java EE 7
 
JAX-RS 2.0: RESTful Web Services
JAX-RS 2.0: RESTful Web ServicesJAX-RS 2.0: RESTful Web Services
JAX-RS 2.0: RESTful Web Services
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_davidd
 
Aplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeansAplicações HTML5 com Java EE 7 e NetBeans
Aplicações HTML5 com Java EE 7 e NetBeans
 
Java EE 7 for WebLogic 12c Developers
Java EE 7 for WebLogic 12c DevelopersJava EE 7 for WebLogic 12c Developers
Java EE 7 for WebLogic 12c Developers
 
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
The Java EE 7 Platform: Productivity & HTML5 at JavaOne Latin America 2012
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)EJB et WS (Montreal JUG - 12 mai 2011)
EJB et WS (Montreal JUG - 12 mai 2011)
 

More from Arun Gupta

More from Arun Gupta (20)

5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf5 Skills To Force Multiply Technical Talents.pdf
5 Skills To Force Multiply Technical Talents.pdf
 
Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019Machine Learning using Kubernetes - AI Conclave 2019
Machine Learning using Kubernetes - AI Conclave 2019
 
Machine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and KubernetesMachine Learning using Kubeflow and Kubernetes
Machine Learning using Kubeflow and Kubernetes
 
Secure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using FirecrackerSecure and Fast microVM for Serverless Computing using Firecracker
Secure and Fast microVM for Serverless Computing using Firecracker
 
Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019Building Java in the Open - j.Day at OSCON 2019
Building Java in the Open - j.Day at OSCON 2019
 
Why Amazon Cares about Open Source
Why Amazon Cares about Open SourceWhy Amazon Cares about Open Source
Why Amazon Cares about Open Source
 
Machine learning using Kubernetes
Machine learning using KubernetesMachine learning using Kubernetes
Machine learning using Kubernetes
 
Building Cloud Native Applications
Building Cloud Native ApplicationsBuilding Cloud Native Applications
Building Cloud Native Applications
 
Chaos Engineering with Kubernetes
Chaos Engineering with KubernetesChaos Engineering with Kubernetes
Chaos Engineering with Kubernetes
 
How to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAMHow to be a mentor to bring more girls to STEAM
How to be a mentor to bring more girls to STEAM
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
The Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 KeynoteThe Serverless Tidal Wave - SwampUP 2018 Keynote
The Serverless Tidal Wave - SwampUP 2018 Keynote
 
Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018Introduction to Amazon EKS - KubeCon 2018
Introduction to Amazon EKS - KubeCon 2018
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv Summit
 
Top 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's LandscapeTop 10 Technology Trends Changing Developer's Landscape
Top 10 Technology Trends Changing Developer's Landscape
 
Container Landscape in 2017
Container Landscape in 2017Container Landscape in 2017
Container Landscape in 2017
 
Java EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShiftJava EE and NoSQL using JBoss EAP 7 and OpenShift
Java EE and NoSQL using JBoss EAP 7 and OpenShift
 
Docker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developersDocker, Kubernetes, and Mesos recipes for Java developers
Docker, Kubernetes, and Mesos recipes for Java developers
 
Thanks Managers!
Thanks Managers!Thanks Managers!
Thanks Managers!
 
Migrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to ContainersMigrate your traditional VM-based Clusters to Containers
Migrate your traditional VM-based Clusters to Containers
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Java EE 7: Boosting Productivity and Embracing HTML5

  • 1. The Java EE 7 Platform Productivity++ and HTML5 Arun Gupta Director, Developer Advocacy, Red Hat blog.arungupta.me, @arungupta 1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Picture Here
  • 2. Java: Broadest Industry Adoption 9,000,000 JAVA DEVELOPERS DEPLOYING TO 18 COMPLIANT APPLICATION SERVERS 2Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 3. Java EE 7 Platform Jun 12, 2013 3Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 4. Java EE 7 Themes ENTERPRISE EDITION MEETING ENTERPRISE DEMANDS DEVELOPER PRODUCTIVITY Java EE 7  More annotated POJOs  Less boilerplate code  Cohesive integrated platform 4Copyright © 2012, Oracle and/or its affiliates. All rights reserved.     WebSockets JSON Servlet 3.1 NIO REST  Batch  Concurrency  Simplified JMS
  • 5. Top Ten Features in Java EE 7 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. WebSocket client/server endpoints Batch Applications JSON Processing Concurrency Utilities Simplified JMS API @Transactional and @TransactionScoped JAX-RS Client API Default Resources More annotated POJOs Faces Flow 5Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 6. Java API for WebSocket 1.0 Server and Client WebSocket Endpoint Annotated: @ServerEndpoint, @ClientEndpoint Programmatic: Endpoint Lifecycle methods Packaging and Deployment 6Copyright © 2012, Oracle and/or its affiliates. All rights reserved. @ServerEndpoint(“/chat”) public class ChatServer { @OnMessage public void chat(String m) { . . . } }
  • 7. Java API for WebSocket 1.0 Chat Server @ServerEndpoint("/chat") public class ChatBean { static Set<Session> peers = Collections.synchronizedSet(…); @OnOpen public void onOpen(Session peer) { peers.add(peer); } @OnClose public void onClose(Session peer) { peers.remove(peer); } . . . 7Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 8. Java API for WebSocket 1.0 Chat Server (contd.) . . . @OnMessage public void message(String message) { for (Session peer : peers) { peer.getRemote().sendObject(message); } } } 8Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9. JSON Processing 1.0 API to parse and generate JSON Streaming API ● Low-level, efficient way to parse/generate JSON ● Similar to StAX API in XML world Object Model API ● Simple, easy to use high-level API ● Similar to DOM API in XML world 9Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10. Java API for JSON Processing 1.0 Streaming API { "firstName": "John", "lastName": "Smith", "age": 25, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] } JsonParser p = Json.createParser(…); JsonParser.Event event = p.next(); event = p.next(); event = p.next(); String name = p.getString(); 10Copyright © 2012, Oracle and/or its affiliates. All rights reserved. // START_OBJECT // KEY_NAME // VALUE_STRING // "John”
  • 11. Batch Applications for Java Platform 1.0 Suited for non-interactive, bulk-oriented, and long-running tasks Batch execution: sequential, parallel, decision-based Processing Styles ● Item-oriented: Chunked (primary) ● Task-oriented: Batchlet 11Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 12. Batch Applications 1.0 Concepts Batch process Manage batch process Independent sequential phase of job Chunk Metadata for jobs 12Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13. Batch Applications 1.0 Chunked Job Specification <step id=”sendStatements”> …implements ItemReader { <chunk item-count=“3”> public Object readItem() { <reader ref=”accountReader”/> // read account using JPA <processor ref=”accountProcessor”/> } <writer ref=”emailWriter”/> </step> …implements ItemProcessor { Public Object processItems(Object account) { // read Account, return Statement } …implements ItemWriter { public void writeItems(List accounts) { // use JavaMail to send email } 13Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14. Concurrency Utilities for Java EE 1.0 Extension of Java SE Concurrency Utilities API Provide asynchronous capabilities to Java EE application components Provides 4 types of managed objects ● ManagedExecutorService ● ManagedScheduledExecutorService ● ManagedThreadFactory ● ContextService Context Propagation 14Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15. Concurrency Utilities for Java EE 1.0 Submit Tasks to ManagedExecutorService using JNDI public class TestServlet extends HttpPServlet { @Resource(name=“java:comp/DefaultManagedExecutorService”) ManagedExecutorService executor; Future future = executor.submit(new MyTask()); class MyTask implements Runnable { public void run() { . . . // task logic } } } 15Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16. Java Message Service 2.0 Get More from Less Java EE 7 New JMSContext interface AutoCloseable JMSContext, Connection, Session, … Use of runtime exceptions Method chaining on JMSProducer Simplified message sending 16Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17. Java Message Service 2.0 Sending a Message using JMS 1.1 @Resource(lookup = "myConnectionFactory”) ConnectionFactory connectionFactory; @Resource(lookup = "myQueue”) Queue myQueue; public void sendMessage (String payload) { Connection connection = null; try { connection = connectionFactory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(myQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } catch (JMSException ex) { //. . . } finally { if (connection != null) { try { connection.close(); } catch (JMSException ex) { //. . . } } } } 17Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Application Server Specific Resources Boilerplate Code Exception Handling
  • 18. Java Message Service 2.0 Sending a Message @Inject JMSContext context; @Resource(lookup = "java:global/jms/demoQueue”) Queue demoQueue; public void sendMessage(String payload) { context.createProducer().send(demoQueue, payload); } 18Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19. Java API for RESTful Web Services 2.0 Client API Message Filters and Entity Interceptors Asynchronous Processing – Server and Client Common Configuration 19Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20. Java API for RESTful Web Services 2.0 Client API // Get instance of Client Client client = ClientBuilder.newClient(); // Get customer name for the shipped products String name = client.target(“../orders/ {orderId}/customer”) .resolveTemplate(”orderId", ”10”) .queryParam(”shipped", ”true”) .request() .get(String.class); 20Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21. Contexts and Dependency Injection 1.1 Automatic enablement for beans with scope annotation and EJBs “beans.xml” is optional Bean discovery mode ● all: All types ● annotated: Types with bean defining annotation ● none: Disable CDI @Vetoed for programmatic disablement of classes Global ordering/priority of interceptors and decorators 21Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22. Bean Validation 1.1 Java EE 7 Alignment with Dependency Injection Method-level validation Constraints on parameters and return values ● Check pre-/post-conditions Integration with JAX-RS 22Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23. Bean Validation 1.1 Method Parameter and Result Validation public void placeOrder( @NotNull String productName, Built-in @NotNull @Max(“10”) Integer quantity, @Customer String customer) { Custom //. . . } @Future public Date getAppointment() { //. . . } 23Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 24. Java Persistence API 2.1 Schema Generation javax.persistence.schema-generation.* properties Unsynchronized Persistence Contexts Bulk update/delete using Criteria User-defined functions using FUNCTION Stored Procedure Query 24Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 25. Servlet 3.1 Non-blocking I/O Protocol Upgrade Security Enhancements <deny-uncovered-http-methods>: Deny request to HTTP methods not explicitly covered 25Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 26. Servlet 3.1 Non-blocking I/O Traditional public class TestServlet extends HttpServlet protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServletInputStream input = request.getInputStream(); byte[] b = new byte[1024]; int len = -1; while ((len = input.read(b)) != -1) { . . . } } } 26Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 27. Servlet 3.1 Non-blocking I/O: doGet AsyncContext context = request.startAsync(); ServletInputStream input = request.getInputStream(); input.setReadListener( new MyReadListener(input, context)); 27Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 28. Servlet 3.1 Non-blocking read @Override public void onDataAvailable() { try { StringBuilder sb = new StringBuilder(); int len = -1; byte b[] = new byte[1024]; while (input.isReady() && (len = input.read(b)) != -1) { String data = new String(b, 0, len); System.out.println("--> " + data); } } catch (IOException ex) { . . . } } . . . 28Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 29. JavaServer Faces 2.2 Faces Flow Resource Library Contracts HTML5 Friendly Markup Support Pass through attributes and elements Cross Site Request Forgery Protection Loading Facelets via ResourceHandler h:inputFile: New File Upload Component 29Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 30. Java Transaction API 1.2 @Transactional: Define transaction boundaries on CDI managed beans @TransactionScoped: CDI scope for bean instances scoped to the active JTA transaction Java EE 7 30Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 31. Java EE 7 JSRs CDI Extensions JSF 2.2, JSP 2.3, EL 3.0 Web Fragments JAX-RS 2.0, JAX-WS 2.2 JSON 1.0 WebSocket 1.0 CDI 1.1 Interceptors 1.2, JTA 1.2 Common Annotations 1.1 EJB 3.2 Managed Beans 1.0 JPA 2.1 31Copyright © 2012, Oracle and/or its affiliates. All rights reserved. JMS 2.0 Concurrency 1.0 JCA 1.7 Batch 1.0 Bean Validation 1.1 Servlet 3.1
  • 32. DOWNLOAD Java EE 7 SDK oracle.com/javaee GlassFish 4.0 Full Platform or Web Profile glassfish.org 32Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 33. From JBoss Community wildfly.org/download 33Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 34. Adopt-a-JSR Participating JUGs 34Copyright © 2012, Oracle and/or its affiliates. All rights reserved.