SlideShare a Scribd company logo
© 2015 IBM Corporation
AAI-1713
Introduction to Java EE 7
Kevin Sutter, STSM
WebSphere Java EE Architect
Java: Broadest Industry Adoption
9,000,000
JAVA DEVELOPERS
DEPLOYING TO 18 COMPLIANT APPLICATION SERVERS
Java EE 7 Platform
Jun 12, 2013
Java EE 7 Themes
 Batch
 Concurrency
 Simplified JMS
 More annotated POJOs
 Less boilerplate code
 Cohesive integrated
platform
DEVELOPER
PRODUCTIVITY
 WebSockets
 JSON
 Servlet 3.1 NIO
 REST
MEETING
ENTERPRISE
DEMANDS
Java EE 7
Top Ten Features in Java EE 7
1. WebSocket client/server endpoints
2. Batch Applications
3. JSON Processing
4. Concurrency Utilities
5. Simplified JMS API
6. @Transactional and @TransactionScoped
7. JAX-RS Client API
8. Default Resources
9. More annotated POJOs
10. Faces Flow
Java API for WebSocket 1.0
• Server and Client WebSocket Endpoint
• Annotated: @ServerEndpoint, @ClientEndpoint
• Programmatic: Endpoint
• Lifecycle events support
• Standard Packaging and Deployment
@ServerEndpoint("/chat")
public class ChatServer {
@OnMessage
public void chat(String m) {
. . .
}
}
Available 4Q2014 via Liberty Repository!
Java API for WebSocket 1.0
@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);
}
. . .
Chat Server
Java API for WebSocket 1.0
. . .
@OnMessage
public void message(String message) {
for (Session peer : peers) {
peer.getRemote().sendObject(message);
}
}
}
Chat Server (contd.)
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
Available 4Q2014 via Liberty Repository!
{
"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(); // START_OBJECT
event = p.next(); // KEY_NAME
event = p.next(); // VALUE_STRING
String name = p.getString(); // "John”
Java API for JSON Processing 1.0
Streaming API
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
Available via Liberty Beta!
Batch Applications 1.0
Concepts
Metadata for jobs
Manage
batch
process
Batch
process
Independent
sequential
phase of job
Chunk
<step id="sendStatements">
<chunk item-count="3">
<reader ref="accountReader"/>
<processor ref="accountProcessor"/>
<writer ref="emailWriter"/>
</step>
...implements ItemReader {
public Object readItem() {
// read account using JPA
}
...implements ItemProcessor {
Public Object processItems(Object account) {
// read Account, return Statement
}
...implements ItemWriter {
public void writeItems(List statements) {
// use JavaMail to send email
}
Batch Applications 1.0
Chunked Job Specification
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
Available 4Q2014 via Liberty Repository!
Concurrency Utilities for Java EE 1.0
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
}
}
}
Submit Tasks to ManagedExecutorService using JNDI
Java Message Service 2.0
• New JMSContext interface
• AutoCloseable JMSContext, Connection, Session, …
• Use of runtime exceptions
• Method chaining on JMSProducer
• Simplified message sending
Get More from Less
Java EE 7
Available via Liberty Beta!
@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) {
//. . .
}
}
}
}
Application Server
Specific Resources
Boilerplate Code
Exception Handling
Java Message Service 2.0
Sending a Message using JMS 1.1
Java Message Service 2.0
@Inject
JMSContext context;
@Resource(lookup = "java:global/jms/demoQueue")
Queue demoQueue;
public void sendMessage(String payload) {
context.createProducer().send(demoQueue, payload);
}
Sending a Message
Java API for RESTful Web Services 2.0
• Client API
• Message Filters and Entity Interceptors
• Asynchronous Processing – Server and Client
• Common Configuration
Available via Liberty Beta!
Java API for RESTful Web Services 2.0
// 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);
Client API
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 (default)
• none: Disable CDI
• @Vetoed for programmatic disablement of classes
• Global ordering/priority of interceptors and decorators
Available via Liberty Beta!
Bean Validation 1.1
• Alignment with Dependency Injection
• Method-level validation
• Constraints on parameters and return values
• Check pre-/post-conditions
• Integration with JAX-RS
Java EE 7
Available via Liberty Beta!
Built-in
Custom
@Future
public Date getAppointment() {
//. . .
}
public void placeOrder(
@NotNull String productName,
@NotNull @Max("10") Integer quantity,
@Customer String customer) {
//. . .
}
Bean Validation 1.1
Method Parameter and Result Validation
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
• Entity Graphs
Available via Liberty Beta!
Servlet 3.1
• Non-blocking I/O
• Protocol Upgrade
• HttpUpgradeHandler – necessary for Web Sockets
• Security Enhancements
• <deny-uncovered-http-methods>: Deny request to HTTP
methods not explicitly covered by specified constaints
Available 4Q2014 via Liberty Repository!
Servlet 3.1
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) {
. . .
}
}
}
Non-blocking I/O Traditional
Servlet 3.1
AsyncContext context = request.startAsync();
ServletInputStream input = request.getInputStream();
input.setReadListener(
new MyReadListener(input, context));
Non-blocking I/O: doGet
Servlet 3.1
@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) {
. . .
}
}
. . .
Non-blocking read
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
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
Available via Liberty Beta!
EJB 3.2
Servlet 3.1
CDI
Extensions
BeanValidation1.1
Batch 1.0
Web
Fragments
Java EE 7 JSRs
JCA 1.7JMS 2.0JPA 2.1
Managed Beans 1.0
Concurrency 1.0
Common
Annotations 1.1
Interceptors
1.2, JTA 1.2
CDI 1.1
JSF 2.2,
JSP 2.3,
EL 3.0
JAX-RS 2.0,
JAX-WS 2.2
JSON 1.0
WebSocket
1.0
WebSphere Java EE 7 “Roadmap”
• Java EE 7 Statement of Direction
• http://www-
01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/4/897/ENUS214-
184/index.html&lang=en&request_locale=en
• IBM intends to deliver a Java EE 7 full platform compliant implementation of WebSphere
Application Server.
• IBM intends to deliver additional Java EE 7 components and additional technologies for
WebSphere Application Server through continuous delivery of new features in the coming
months.
• Liberty GA Deliverables of Java EE Features
• Web Sockets 1.0 (4Q2014) and Web Sockets 1.1 (1Q2015)
• Servlet 3.1 (4Q2014)
• JSON-P 1.0 (4Q2014)
• Concurrency Utilities 1.0 (4Q2014)
• Java Server Pages (JSP) 2.3 (1Q2015)
• Expression Language 3.0 (1Q2015)
• Common Annotations 1.2 (1Q2015)
• JDBC 4.1 (1Q2015)
• Liberty Beta (Preliminary versions of Java EE features)
• https://www.ibmdw.net/wasdev/downloads/liberty-profile-beta/
• Future Content …
• Extrapolate at your own speed… 
Adopt-a-JSR
Participating JUGs
Sampling of Related Sessions…
• AAI-1713A: Introduction to Java EE 7
• Monday, 2-3pm, Mandalay Bay, Reef Ballroom E
• AAI-1641A: Introduction to Web Sockets
• Monday, 5-6pm, Mandalay Bay, Reef Ballroom E
• AAI-1313A: Agile Development Using Java EE 7 with WebSphere Liberty Profile
(LAB)
• Tuesday, 8-10am, Mandalay Bay, South Seas Ballroom D
• AAI-2236A: Using the New Java Concurrency Utilities with IBM WebSphere
• Tuesday, 2-3pm, Mandalay Bay, Reef Ballroom D
• AAI-2235A: OpenJPA and EclipseLink Usage Scenarios Explained
• Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom A
• AAI-1610A: Configuring IBM WebSphere Application Server for Enterprise
Messaging Needs
• Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom E
• AAI-3085A: Don’t Wait! Develop Responsive Applications with Java EE7 Instead
• Thursday, 10:30-11:30am, Mandalay Bay, Lagoon L
33
Questions?
Notices and Disclaimers
Copyright © 2015 by International Business Machines Corporation (IBM). No part of this document may be reproduced or
transmitted in any form without written permission from IBM.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
IBM.
Information in these presentations (including information relating to products that have not yet been announced by IBM) has been
reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM
shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY,
EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF
THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT
OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the
agreements under which they are provided.
Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without
notice.
Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are
presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual
performance, cost, savings or other results in other operating environments may vary.
References in this document to IBM products, programs, or services does not imply that IBM intends to make such products,
programs or services available in all countries in which IBM operates or does business.
Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not
necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither
intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.
It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal
counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s
business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or
represent or warrant that its services or products will ensure that the customer is in compliance with any law.
Notices and Disclaimers (con’t)
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products in connection with this
publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM
products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products.
IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to
interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
The provision of the information contained herein is not intended to, and does not, grant any right or license under any
IBM patents, copyrights, trademarks or other intellectual property right.
• IBM, the IBM logo, ibm.com, Bluemix, Blueworks Live, CICS, Clearcase, DOORS®, Enterprise Document
Management System™, Global Business Services ®, Global Technology Services ®, Information on Demand,
ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™,
PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®,
pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, SoDA, SPSS, StoredIQ, Tivoli®, Trusteer®,
urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of
International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and
service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on
the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
Thank You
Your Feedback is
Important!
Access the InterConnect 2015
Conference CONNECT Attendee
Portal to complete your session
surveys from your smartphone,
laptop or conference kiosk.

More Related Content

PDF
jsf2 Notes
PDF
Lecture 1: Introduction to JEE
PDF
Lecture 3: Servlets - Session Management
PDF
Lecture 2: Servlets
PDF
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
PDF
Lecture 7 Web Services JAX-WS & JAX-RS
PDF
Java EE 8 Recipes
PPTX
Batching and Java EE (jdk.io)
jsf2 Notes
Lecture 1: Introduction to JEE
Lecture 3: Servlets - Session Management
Lecture 2: Servlets
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
Lecture 7 Web Services JAX-WS & JAX-RS
Java EE 8 Recipes
Batching and Java EE (jdk.io)

What's hot (20)

ODP
JUDCON India 2014 Java EE 7 talk
PDF
Lecture 5 JSTL, custom tags, maven
PDF
Lecture 6 Web Sockets
PDF
Java Web Programming [2/9] : Servlet Basic
PDF
Lecture 9 - Java Persistence, JPA 2
PDF
Java Web Programming [3/9] : Servlet Advanced
PDF
Easy integration of Bluemix services with your applications
PDF
Java Web Programming [4/9] : JSP Basic
PPT
Java EE Introduction
PPT
Session 4 Tp4
PDF
Java EE 8 Web Frameworks: A Look at JSF vs MVC
PPT
Jspprogramming
DOC
24 collections framework interview questions
PDF
50 New Features of Java EE 7 in 50 minutes
PPT
Java EE 7 (Hamed Hatami)
ODP
Java EE and Glassfish
PPT
Servlet programming
ODP
Hibernate Developer Reference
JUDCON India 2014 Java EE 7 talk
Lecture 5 JSTL, custom tags, maven
Lecture 6 Web Sockets
Java Web Programming [2/9] : Servlet Basic
Lecture 9 - Java Persistence, JPA 2
Java Web Programming [3/9] : Servlet Advanced
Easy integration of Bluemix services with your applications
Java Web Programming [4/9] : JSP Basic
Java EE Introduction
Session 4 Tp4
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Jspprogramming
24 collections framework interview questions
50 New Features of Java EE 7 in 50 minutes
Java EE 7 (Hamed Hatami)
Java EE and Glassfish
Servlet programming
Hibernate Developer Reference
Ad

Viewers also liked (11)

PDF
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
PPTX
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
PDF
Java EE 7: Boosting Productivity and Embracing HTML5
PDF
50 features of Java EE 7 in 50 minutes at JavaZone 2014
PDF
Deploying Web Applications with WildFly 8
PDF
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
PDF
CQRS is not Event Sourcing
PDF
CDI 1.1 university
PDF
Package your Java EE Application using Docker and Kubernetes
PDF
An Introduction to Kubernetes
PDF
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
JavaEE & GlassFish UG - Digital JavaEE 7 New & Noteworthy by P.Pilgrim
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
Java EE 7: Boosting Productivity and Embracing HTML5
50 features of Java EE 7 in 50 minutes at JavaZone 2014
Deploying Web Applications with WildFly 8
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
CQRS is not Event Sourcing
CDI 1.1 university
Package your Java EE Application using Docker and Kubernetes
An Introduction to Kubernetes
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Ad

Similar to AAI-1713 Introduction to Java EE 7 (20)

PDF
Haj 4328-java ee 7 overview
PDF
Contextual Dependency Injection for Apachecon 2010
PDF
Overview of Java EE 6 by Roberto Chinnici at SFJUG
PDF
Java EE 6, Eclipse @ EclipseCon
PDF
What’s new in Java SE, EE, ME, Embedded world & new Strategy
PDF
Utilizing JSF Front Ends with Microservices
PPTX
Java EE8 - by Kito Mann
PDF
Migrating to Jakarta EE 10
PPTX
Java EE 8 Update
PDF
Java EE 8: On the Horizon
ODP
Groovy & Grails eXchange 2012 vert.x presentation
PPTX
Getting Started with Java EE 7
PPTX
Java ee 8 + security overview
PPTX
Advance Java Topics (J2EE)
PPT
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
PPT
Lecture 19 dynamic web - java - part 1
PDF
Java EE 與 雲端運算的展望
PPTX
Java EE 8
PPT
Spring 3.1: a Walking Tour
PDF
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Haj 4328-java ee 7 overview
Contextual Dependency Injection for Apachecon 2010
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Java EE 6, Eclipse @ EclipseCon
What’s new in Java SE, EE, ME, Embedded world & new Strategy
Utilizing JSF Front Ends with Microservices
Java EE8 - by Kito Mann
Migrating to Jakarta EE 10
Java EE 8 Update
Java EE 8: On the Horizon
Groovy & Grails eXchange 2012 vert.x presentation
Getting Started with Java EE 7
Java ee 8 + security overview
Advance Java Topics (J2EE)
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Lecture 19 dynamic web - java - part 1
Java EE 與 雲端運算的展望
Java EE 8
Spring 3.1: a Walking Tour
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)

More from WASdev Community (20)

PPTX
Liberty Deep Dive
PPTX
Introduction to WebSockets
PPTX
Don't Wait! Develop Responsive Applications with Java EE7 Instead
PPTX
Liberty management
PPTX
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
PDF
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
PDF
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
PDF
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
PDF
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
PDF
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
PDF
AAI-2236 Using the new Java Concurrency Utilities with IBM WebSphere
PDF
AAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
PDF
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
PDF
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
PDF
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
PDF
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
PDF
AAI-1305 Choosing WebSphere Liberty for Java EE Deployments
PDF
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
PDF
Planning For Catastrophe with IBM WAS and IBM BPM
PDF
Arduinos, application servers, and me: Adventures in and out of the cloud
Liberty Deep Dive
Introduction to WebSockets
Don't Wait! Develop Responsive Applications with Java EE7 Instead
Liberty management
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
AAI-2236 Using the new Java Concurrency Utilities with IBM WebSphere
AAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
AAI-1305 Choosing WebSphere Liberty for Java EE Deployments
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
Planning For Catastrophe with IBM WAS and IBM BPM
Arduinos, application servers, and me: Adventures in and out of the cloud

Recently uploaded (20)

PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Salesforce Agentforce AI Implementation.pdf
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
assetexplorer- product-overview - presentation
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Transform Your Business with a Software ERP System
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Patient Appointment Booking in Odoo with online payment
Autodesk AutoCAD Crack Free Download 2025
CHAPTER 2 - PM Management and IT Context
Salesforce Agentforce AI Implementation.pdf
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
assetexplorer- product-overview - presentation
Navsoft: AI-Powered Business Solutions & Custom Software Development
Digital Systems & Binary Numbers (comprehensive )
Monitoring Stack: Grafana, Loki & Promtail
Transform Your Business with a Software ERP System
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Advanced SystemCare Ultimate Crack + Portable (2025)
17 Powerful Integrations Your Next-Gen MLM Software Needs

AAI-1713 Introduction to Java EE 7

  • 1. © 2015 IBM Corporation AAI-1713 Introduction to Java EE 7 Kevin Sutter, STSM WebSphere Java EE Architect
  • 2. Java: Broadest Industry Adoption 9,000,000 JAVA DEVELOPERS DEPLOYING TO 18 COMPLIANT APPLICATION SERVERS
  • 3. Java EE 7 Platform Jun 12, 2013
  • 4. Java EE 7 Themes  Batch  Concurrency  Simplified JMS  More annotated POJOs  Less boilerplate code  Cohesive integrated platform DEVELOPER PRODUCTIVITY  WebSockets  JSON  Servlet 3.1 NIO  REST MEETING ENTERPRISE DEMANDS Java EE 7
  • 5. Top Ten Features in Java EE 7 1. WebSocket client/server endpoints 2. Batch Applications 3. JSON Processing 4. Concurrency Utilities 5. Simplified JMS API 6. @Transactional and @TransactionScoped 7. JAX-RS Client API 8. Default Resources 9. More annotated POJOs 10. Faces Flow
  • 6. Java API for WebSocket 1.0 • Server and Client WebSocket Endpoint • Annotated: @ServerEndpoint, @ClientEndpoint • Programmatic: Endpoint • Lifecycle events support • Standard Packaging and Deployment @ServerEndpoint("/chat") public class ChatServer { @OnMessage public void chat(String m) { . . . } } Available 4Q2014 via Liberty Repository!
  • 7. Java API for WebSocket 1.0 @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); } . . . Chat Server
  • 8. Java API for WebSocket 1.0 . . . @OnMessage public void message(String message) { for (Session peer : peers) { peer.getRemote().sendObject(message); } } } Chat Server (contd.)
  • 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 Available 4Q2014 via Liberty Repository!
  • 10. { "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(); // START_OBJECT event = p.next(); // KEY_NAME event = p.next(); // VALUE_STRING String name = p.getString(); // "John” Java API for JSON Processing 1.0 Streaming API
  • 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 Available via Liberty Beta!
  • 12. Batch Applications 1.0 Concepts Metadata for jobs Manage batch process Batch process Independent sequential phase of job Chunk
  • 13. <step id="sendStatements"> <chunk item-count="3"> <reader ref="accountReader"/> <processor ref="accountProcessor"/> <writer ref="emailWriter"/> </step> ...implements ItemReader { public Object readItem() { // read account using JPA } ...implements ItemProcessor { Public Object processItems(Object account) { // read Account, return Statement } ...implements ItemWriter { public void writeItems(List statements) { // use JavaMail to send email } Batch Applications 1.0 Chunked Job Specification
  • 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 Available 4Q2014 via Liberty Repository!
  • 15. Concurrency Utilities for Java EE 1.0 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 } } } Submit Tasks to ManagedExecutorService using JNDI
  • 16. Java Message Service 2.0 • New JMSContext interface • AutoCloseable JMSContext, Connection, Session, … • Use of runtime exceptions • Method chaining on JMSProducer • Simplified message sending Get More from Less Java EE 7 Available via Liberty Beta!
  • 17. @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) { //. . . } } } } Application Server Specific Resources Boilerplate Code Exception Handling Java Message Service 2.0 Sending a Message using JMS 1.1
  • 18. Java Message Service 2.0 @Inject JMSContext context; @Resource(lookup = "java:global/jms/demoQueue") Queue demoQueue; public void sendMessage(String payload) { context.createProducer().send(demoQueue, payload); } Sending a Message
  • 19. Java API for RESTful Web Services 2.0 • Client API • Message Filters and Entity Interceptors • Asynchronous Processing – Server and Client • Common Configuration Available via Liberty Beta!
  • 20. Java API for RESTful Web Services 2.0 // 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); Client API
  • 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 (default) • none: Disable CDI • @Vetoed for programmatic disablement of classes • Global ordering/priority of interceptors and decorators Available via Liberty Beta!
  • 22. Bean Validation 1.1 • Alignment with Dependency Injection • Method-level validation • Constraints on parameters and return values • Check pre-/post-conditions • Integration with JAX-RS Java EE 7 Available via Liberty Beta!
  • 23. Built-in Custom @Future public Date getAppointment() { //. . . } public void placeOrder( @NotNull String productName, @NotNull @Max("10") Integer quantity, @Customer String customer) { //. . . } Bean Validation 1.1 Method Parameter and Result Validation
  • 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 • Entity Graphs Available via Liberty Beta!
  • 25. Servlet 3.1 • Non-blocking I/O • Protocol Upgrade • HttpUpgradeHandler – necessary for Web Sockets • Security Enhancements • <deny-uncovered-http-methods>: Deny request to HTTP methods not explicitly covered by specified constaints Available 4Q2014 via Liberty Repository!
  • 26. Servlet 3.1 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) { . . . } } } Non-blocking I/O Traditional
  • 27. Servlet 3.1 AsyncContext context = request.startAsync(); ServletInputStream input = request.getInputStream(); input.setReadListener( new MyReadListener(input, context)); Non-blocking I/O: doGet
  • 28. Servlet 3.1 @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) { . . . } } . . . Non-blocking read
  • 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
  • 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 Available via Liberty Beta!
  • 31. EJB 3.2 Servlet 3.1 CDI Extensions BeanValidation1.1 Batch 1.0 Web Fragments Java EE 7 JSRs JCA 1.7JMS 2.0JPA 2.1 Managed Beans 1.0 Concurrency 1.0 Common Annotations 1.1 Interceptors 1.2, JTA 1.2 CDI 1.1 JSF 2.2, JSP 2.3, EL 3.0 JAX-RS 2.0, JAX-WS 2.2 JSON 1.0 WebSocket 1.0
  • 32. WebSphere Java EE 7 “Roadmap” • Java EE 7 Statement of Direction • http://www- 01.ibm.com/common/ssi/ShowDoc.wss?docURL=/common/ssi/rep_ca/4/897/ENUS214- 184/index.html&lang=en&request_locale=en • IBM intends to deliver a Java EE 7 full platform compliant implementation of WebSphere Application Server. • IBM intends to deliver additional Java EE 7 components and additional technologies for WebSphere Application Server through continuous delivery of new features in the coming months. • Liberty GA Deliverables of Java EE Features • Web Sockets 1.0 (4Q2014) and Web Sockets 1.1 (1Q2015) • Servlet 3.1 (4Q2014) • JSON-P 1.0 (4Q2014) • Concurrency Utilities 1.0 (4Q2014) • Java Server Pages (JSP) 2.3 (1Q2015) • Expression Language 3.0 (1Q2015) • Common Annotations 1.2 (1Q2015) • JDBC 4.1 (1Q2015) • Liberty Beta (Preliminary versions of Java EE features) • https://www.ibmdw.net/wasdev/downloads/liberty-profile-beta/ • Future Content … • Extrapolate at your own speed… 
  • 34. Sampling of Related Sessions… • AAI-1713A: Introduction to Java EE 7 • Monday, 2-3pm, Mandalay Bay, Reef Ballroom E • AAI-1641A: Introduction to Web Sockets • Monday, 5-6pm, Mandalay Bay, Reef Ballroom E • AAI-1313A: Agile Development Using Java EE 7 with WebSphere Liberty Profile (LAB) • Tuesday, 8-10am, Mandalay Bay, South Seas Ballroom D • AAI-2236A: Using the New Java Concurrency Utilities with IBM WebSphere • Tuesday, 2-3pm, Mandalay Bay, Reef Ballroom D • AAI-2235A: OpenJPA and EclipseLink Usage Scenarios Explained • Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom A • AAI-1610A: Configuring IBM WebSphere Application Server for Enterprise Messaging Needs • Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom E • AAI-3085A: Don’t Wait! Develop Responsive Applications with Java EE7 Instead • Thursday, 10:30-11:30am, Mandalay Bay, Lagoon L 33
  • 36. Notices and Disclaimers Copyright © 2015 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM. Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided. Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice. Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary. References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business. Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation. It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law.
  • 37. Notices and Disclaimers (con’t) Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right. • IBM, the IBM logo, ibm.com, Bluemix, Blueworks Live, CICS, Clearcase, DOORS®, Enterprise Document Management System™, Global Business Services ®, Global Technology Services ®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, SoDA, SPSS, StoredIQ, Tivoli®, Trusteer®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
  • 38. Thank You Your Feedback is Important! Access the InterConnect 2015 Conference CONNECT Attendee Portal to complete your session surveys from your smartphone, laptop or conference kiosk.