The First Contact
with Java EE 7
Questions?
Ask them right away!
The First Contact with Java EE 7
New Specifications
• Websockets
• Batch Applications
• Concurrency Utilities
• JSON Processing
Improvements
• Simplified JMS API
• Default Resources
• JAX-RS Client API
• EJB’s External Transactions
• More Annotations
• Entity Graphs
Java EE 7 JSRs
Websockets
• Supports Client and Server
• Declarative and Programmatic
Websockets Chat Server
@ServerEndpoint("/chatWebSocket")
public class ChatWebSocket {
private static final Set<Session> sessions = Collections.synchronizedSet(new HashSet<Session>());
@OnOpen
public void onOpen(Session session) {sessions.add(session);}
@OnMessage
public void onMessage(String message) {
for (Session session : sessions) { session.getAsyncRemote().sendText(message);}
}
@OnClose
public void onClose(Session session) {sessions.remove(session);}
}
Batch Applications
• For long, non-interactive processes
• Either sequential or parallel (partitions)
• Task or Chunk oriented processing
Batch Applications
Batch Applications - job.xml
<job id="myJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
<step id="myStep" >
<chunk item-count="3">
<reader ref="myItemReader"/>
<processor ref="myItemProcessor"/>
<writer ref="myItemWriter"/>
</chunk>
</step>
</job>
Concurrency Utilities
• Asynchronous capabilities to the Java EE world
• Java SE Concurrency API extension
• Safe and propagates context
Concurrency Utilities
public class TestServlet extends HttpServlet {
@Resource(name = "concurrent/MyExecutorService")
ManagedExecutorService executor;
Future future = executor.submit(new MyTask());
class MyTask implements Runnable {
public void run() {
// do something
}
}
}
JSON Processing
• Read, generate and transform JSON
• Streaming API and Object Model API
JSON Processing
JsonArray jsonArray = Json.createArrayBuilder()
.add(Json.createObjectBuilder()
.add("name", “Jack"))
.add("age", "30"))
.add(Json.createObjectBuilder()
.add("name", “Mary"))
.add("age", "45"))
.build();
[ {“name”:”Jack”, “age”:”30”},
{“name”:”Mary”, “age”:”45”} ]
JMS
• New interface JMSContext
• Modern API with Dependency Injection
• Resources AutoCloseable
• Simplified how to send messages
JMS
@Resource(lookup = "java:global/jms/demoConnectionFactory")
ConnectionFactory connectionFactory;
@Resource(lookup = "java:global/jms/demoQueue")
Queue demoQueue;
public void sendMessage(String payload) {
try {
Connection connection = connectionFactory.createConnection();
try {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(demoQueue);
TextMessage textMessage = session.createTextMessage(payload);
messageProducer.send(textMessage);
} finally {
connection.close();
}
} catch (JMSException ex) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
}
}
JMS
@Inject
private JMSContext context;
@Resource(mappedName = "jms/inboundQueue")
private Queue inboundQueue;
public void sendMessage (String payload) {
context.createProducer()
.setPriority(1)
.setTimeToLive(1000)
.setDeliveryMode(NON_PERSISTENT)
.send(inboundQueue, payload);
}
JAX-RS
• New API to consume REST services
• Asynchronous processing (client and server)
• Filters and Interceptors
JAX-RS
String movie = ClientBuilder.newClient()
.target("http://www.movies.com/movie")
.request(MediaType.TEXT_PLAIN)
.get(String.class);
JPA
• Schema generation
• Stored Procedures
• Entity Graphs
• Unsynchronized Persistence Context
JPA
<persistence-unit name="myPU" transaction-type="JTA">
<properties>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.create-source" value="script"/>
<property name="javax.persistence.schema-generation.drop-source" value="script"/>
<property name="javax.persistence.schema-generation.create-script-source" value="META-INF/
create.sql"/>
<property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/
drop.sql"/>
<property name="javax.persistence.sql-load-script-source" value="META-INF/load.sql"/>
</properties>
</persistence-unit>
JPA
@Entity
@NamedStoredProcedureQuery(name="top10MoviesProcedure",
procedureName = "top10Movies")
public class Movie {}
StoredProcedureQuery query = entityManager.createNamedStoredProcedureQuery(
"top10MoviesProcedure");
query.registerStoredProcedureParameter(1, String.class, ParameterMode.INOUT);
query.setParameter(1, "top10");
query.registerStoredProcedureParameter(2, Integer.class, ParameterMode.IN);
query.setParameter(2, 100);
query.execute();
query.getOutputParameterValue(1);
JSF
• HTML 5 support
• @FlowScoped and @ViewScoped
• File Upload component
• Flow Navigation by Convention
• Resource Library Contracts
Others
• JTA: @Transactional, @TransactionScoped
• Servlet: Non-blocking I/O, Security
• CDI: Automatic for EJB’s and annotated beans (beans.xml
opcional), @Vetoed
• Interceptors: @Priority, @AroundConstruct
• EJB: Passivation opcional
• EL: Lambdas, isolated API
• Bean Validator: Restrictions in parameters and return types
Certified Servers
• Glassfish 4.0
• Wildfly 8.0.0
• TMAX JEUS 8
Java EE 8
• Alignment with Java 8
• JCache
• JSON-B
• MVC
• HTTP 2.0 Support
• Cloud Support
Materials
• Tutorial Java EE 7 - http://docs.oracle.com/javaee/7/
tutorial/doc/home.htm
• Samples Java EE 7 - https://github.com/javaee-
samples/javaee7-samples
• Batch Sample - WoW Auctions - https://github.com/
radcortez/wow-auctions
• WebSocket Sample - Chat Server - https://
github.com/radcortez/cbrjug-websockets-chat
Thank you!

More Related Content

PPTX
Jasig Cas High Availability - Yale University
PPTX
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
PDF
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
PDF
FwDays 2021: Metarhia Technology Stack for Node.js
PDF
What's new in Java EE 7? From HTML5 to JMS 2.0
PDF
Dropwizard
PDF
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
PDF
MeteorJS Introduction
Jasig Cas High Availability - Yale University
Building multi lingual and empatic bots - Sander van den Hoven - Codemotion A...
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
FwDays 2021: Metarhia Technology Stack for Node.js
What's new in Java EE 7? From HTML5 to JMS 2.0
Dropwizard
JavaOne LATAM 2015 - Batch Processing: Processamento em Lotes no Mundo Corpor...
MeteorJS Introduction

What's hot (20)

PPT
Salesforce1 Platform for programmers
PDF
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
PDF
Spring4 whats up doc?
PDF
Lecture 3: Servlets - Session Management
PDF
Managing user's data with Spring Session
PPTX
Rest with Java EE 6 , Security , Backbone.js
PPTX
#3 (Multi Threads With TCP)
PPTX
Web Technologies - forms and actions
PDF
Simple Jdbc With Spring 2.5
PPTX
Rapid API development examples for Impress Application Server / Node.js (jsfw...
PPT
Java - Servlet - Mazenet Solution
PDF
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
ODP
For each In MULE
PDF
«От экспериментов с инфраструктурой до внедрения в продакшен»​
PDF
PPTX
Java Microservices with DropWizard
PDF
Servlets intro
PPTX
Java Servlet
PPTX
Microservices/dropwizard
PPT
Java servlet life cycle - methods ppt
Salesforce1 Platform for programmers
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
Spring4 whats up doc?
Lecture 3: Servlets - Session Management
Managing user's data with Spring Session
Rest with Java EE 6 , Security , Backbone.js
#3 (Multi Threads With TCP)
Web Technologies - forms and actions
Simple Jdbc With Spring 2.5
Rapid API development examples for Impress Application Server / Node.js (jsfw...
Java - Servlet - Mazenet Solution
HTTP Whiteboard - OSGI Compendium 6.0 - How web apps should have been! - R Auge
For each In MULE
«От экспериментов с инфраструктурой до внедрения в продакшен»​
Java Microservices with DropWizard
Servlets intro
Java Servlet
Microservices/dropwizard
Java servlet life cycle - methods ppt
Ad

Viewers also liked (10)

PDF
Java EE 7 meets Java 8
PDF
Coimbra JUG - 1º Encontro - As novidades do Java 8
PDF
Development Horror Stories
PDF
Geecon 2014 - Five Ways to Not Suck at Being a Java Freelancer
PDF
Maven - Taming the Beast
PDF
Migration tales from java ee 5 to 7
PDF
Coimbra JUG - 2º Encontro - O primeiro contacto com Java EE 7
PDF
Java EE 7 Batch processing in the Real World
PDF
Just enough app server
PDF
The 5 People in your Organization that grow Legacy Code
Java EE 7 meets Java 8
Coimbra JUG - 1º Encontro - As novidades do Java 8
Development Horror Stories
Geecon 2014 - Five Ways to Not Suck at Being a Java Freelancer
Maven - Taming the Beast
Migration tales from java ee 5 to 7
Coimbra JUG - 2º Encontro - O primeiro contacto com Java EE 7
Java EE 7 Batch processing in the Real World
Just enough app server
The 5 People in your Organization that grow Legacy Code
Ad

Similar to The First Contact with Java EE 7 (20)

PDF
Indic threads pune12-java ee 7 platformsimplification html5
ODP
JUDCON India 2014 Java EE 7 talk
PDF
Java EE 7, what's in it for me?
PPTX
JEE.next()
PPT
Java EE 7 (Hamed Hatami)
PPT
比XML更好用的Java Annotation
PDF
cq_cxf_integration
PDF
Speed up your Web applications with HTML5 WebSockets
PDF
Building Applications Using Ajax
PPTX
Java EE 8
PDF
GWT Web Socket and data serialization
PPTX
Introduction to Vert.x
PDF
NoSQL and JavaScript: a Love Story
PPTX
Request dispacther interface ppt
PPTX
Servlets
PPTX
Java ee 7 New Features
PDF
Spring Web Services: SOAP vs. REST
PDF
Lecture 6 Web Sockets
PDF
Introduction tomcat7 servlet3
PDF
What's new in JMS 2.0 - OTN Bangalore 2013
Indic threads pune12-java ee 7 platformsimplification html5
JUDCON India 2014 Java EE 7 talk
Java EE 7, what's in it for me?
JEE.next()
Java EE 7 (Hamed Hatami)
比XML更好用的Java Annotation
cq_cxf_integration
Speed up your Web applications with HTML5 WebSockets
Building Applications Using Ajax
Java EE 8
GWT Web Socket and data serialization
Introduction to Vert.x
NoSQL and JavaScript: a Love Story
Request dispacther interface ppt
Servlets
Java ee 7 New Features
Spring Web Services: SOAP vs. REST
Lecture 6 Web Sockets
Introduction tomcat7 servlet3
What's new in JMS 2.0 - OTN Bangalore 2013

More from Roberto Cortez (6)

PDF
Chasing the RESTful Trinity - Client CLI and Documentation
PDF
Baking a Microservice PI(e)
PDF
GraalVM and MicroProfile - A Polyglot Microservices Solution
PDF
Deconstructing and Evolving REST Security
PDF
Lightweight Enterprise Java With Microprofile
PDF
Cluster your MicroProfile Application using CDI and JCache
Chasing the RESTful Trinity - Client CLI and Documentation
Baking a Microservice PI(e)
GraalVM and MicroProfile - A Polyglot Microservices Solution
Deconstructing and Evolving REST Security
Lightweight Enterprise Java With Microprofile
Cluster your MicroProfile Application using CDI and JCache

Recently uploaded (20)

PPTX
Introduction to Windows Operating System
PDF
AI-Powered Fuzz Testing: The Future of QA
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Airline CRS | Airline CRS Systems | CRS System
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PDF
CCleaner 6.39.11548 Crack 2025 License Key
PPTX
Cybersecurity: Protecting the Digital World
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
E-Commerce Website Development Companyin india
PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
PDF
Microsoft Office 365 Crack Download Free
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
Visual explanation of Dijkstra's Algorithm using Python
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
PDF-XChange Editor Plus 10.7.0.398.0 Crack Free Download Latest 2025
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Introduction to Windows Operating System
AI-Powered Fuzz Testing: The Future of QA
Computer Software - Technology and Livelihood Education
Airline CRS | Airline CRS Systems | CRS System
Download Adobe Photoshop Crack 2025 Free
Wondershare Recoverit Full Crack New Version (Latest 2025)
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
CCleaner 6.39.11548 Crack 2025 License Key
Cybersecurity: Protecting the Digital World
Trending Python Topics for Data Visualization in 2025
E-Commerce Website Development Companyin india
Practical Indispensable Project Management Tips for Delivering Successful Exp...
Microsoft Office 365 Crack Download Free
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
Visual explanation of Dijkstra's Algorithm using Python
Tech Workshop Escape Room Tech Workshop
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
BoxLang Dynamic AWS Lambda - Japan Edition
PDF-XChange Editor Plus 10.7.0.398.0 Crack Free Download Latest 2025
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025

The First Contact with Java EE 7

  • 4. New Specifications • Websockets • Batch Applications • Concurrency Utilities • JSON Processing
  • 5. Improvements • Simplified JMS API • Default Resources • JAX-RS Client API • EJB’s External Transactions • More Annotations • Entity Graphs
  • 6. Java EE 7 JSRs
  • 7. Websockets • Supports Client and Server • Declarative and Programmatic
  • 8. Websockets Chat Server @ServerEndpoint("/chatWebSocket") public class ChatWebSocket { private static final Set<Session> sessions = Collections.synchronizedSet(new HashSet<Session>()); @OnOpen public void onOpen(Session session) {sessions.add(session);} @OnMessage public void onMessage(String message) { for (Session session : sessions) { session.getAsyncRemote().sendText(message);} } @OnClose public void onClose(Session session) {sessions.remove(session);} }
  • 9. Batch Applications • For long, non-interactive processes • Either sequential or parallel (partitions) • Task or Chunk oriented processing
  • 11. Batch Applications - job.xml <job id="myJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0"> <step id="myStep" > <chunk item-count="3"> <reader ref="myItemReader"/> <processor ref="myItemProcessor"/> <writer ref="myItemWriter"/> </chunk> </step> </job>
  • 12. Concurrency Utilities • Asynchronous capabilities to the Java EE world • Java SE Concurrency API extension • Safe and propagates context
  • 13. Concurrency Utilities public class TestServlet extends HttpServlet { @Resource(name = "concurrent/MyExecutorService") ManagedExecutorService executor; Future future = executor.submit(new MyTask()); class MyTask implements Runnable { public void run() { // do something } } }
  • 14. JSON Processing • Read, generate and transform JSON • Streaming API and Object Model API
  • 15. JSON Processing JsonArray jsonArray = Json.createArrayBuilder() .add(Json.createObjectBuilder() .add("name", “Jack")) .add("age", "30")) .add(Json.createObjectBuilder() .add("name", “Mary")) .add("age", "45")) .build(); [ {“name”:”Jack”, “age”:”30”}, {“name”:”Mary”, “age”:”45”} ]
  • 16. JMS • New interface JMSContext • Modern API with Dependency Injection • Resources AutoCloseable • Simplified how to send messages
  • 17. JMS @Resource(lookup = "java:global/jms/demoConnectionFactory") ConnectionFactory connectionFactory; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { try { Connection connection = connectionFactory.createConnection(); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer messageProducer = session.createProducer(demoQueue); TextMessage textMessage = session.createTextMessage(payload); messageProducer.send(textMessage); } finally { connection.close(); } } catch (JMSException ex) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex); } }
  • 18. JMS @Inject private JMSContext context; @Resource(mappedName = "jms/inboundQueue") private Queue inboundQueue; public void sendMessage (String payload) { context.createProducer() .setPriority(1) .setTimeToLive(1000) .setDeliveryMode(NON_PERSISTENT) .send(inboundQueue, payload); }
  • 19. JAX-RS • New API to consume REST services • Asynchronous processing (client and server) • Filters and Interceptors
  • 20. JAX-RS String movie = ClientBuilder.newClient() .target("http://www.movies.com/movie") .request(MediaType.TEXT_PLAIN) .get(String.class);
  • 21. JPA • Schema generation • Stored Procedures • Entity Graphs • Unsynchronized Persistence Context
  • 22. JPA <persistence-unit name="myPU" transaction-type="JTA"> <properties> <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> <property name="javax.persistence.schema-generation.create-source" value="script"/> <property name="javax.persistence.schema-generation.drop-source" value="script"/> <property name="javax.persistence.schema-generation.create-script-source" value="META-INF/ create.sql"/> <property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/ drop.sql"/> <property name="javax.persistence.sql-load-script-source" value="META-INF/load.sql"/> </properties> </persistence-unit>
  • 23. JPA @Entity @NamedStoredProcedureQuery(name="top10MoviesProcedure", procedureName = "top10Movies") public class Movie {} StoredProcedureQuery query = entityManager.createNamedStoredProcedureQuery( "top10MoviesProcedure"); query.registerStoredProcedureParameter(1, String.class, ParameterMode.INOUT); query.setParameter(1, "top10"); query.registerStoredProcedureParameter(2, Integer.class, ParameterMode.IN); query.setParameter(2, 100); query.execute(); query.getOutputParameterValue(1);
  • 24. JSF • HTML 5 support • @FlowScoped and @ViewScoped • File Upload component • Flow Navigation by Convention • Resource Library Contracts
  • 25. Others • JTA: @Transactional, @TransactionScoped • Servlet: Non-blocking I/O, Security • CDI: Automatic for EJB’s and annotated beans (beans.xml opcional), @Vetoed • Interceptors: @Priority, @AroundConstruct • EJB: Passivation opcional • EL: Lambdas, isolated API • Bean Validator: Restrictions in parameters and return types
  • 26. Certified Servers • Glassfish 4.0 • Wildfly 8.0.0 • TMAX JEUS 8
  • 27. Java EE 8 • Alignment with Java 8 • JCache • JSON-B • MVC • HTTP 2.0 Support • Cloud Support
  • 28. Materials • Tutorial Java EE 7 - http://docs.oracle.com/javaee/7/ tutorial/doc/home.htm • Samples Java EE 7 - https://github.com/javaee- samples/javaee7-samples • Batch Sample - WoW Auctions - https://github.com/ radcortez/wow-auctions • WebSocket Sample - Chat Server - https:// github.com/radcortez/cbrjug-websockets-chat