SlideShare a Scribd company logo
Java EE 6
All Platform, no clutter
@greyfairer
Agenda
Servlet 3.0, JAX-RS 1.1, JSF 2.0
JSR-330 a.k.a. javax.inject
JSR-299 a.k.a. CDI
Arquillian
CDI Extensions
Servlets 3.0
@WebServlet(name=”MyServlet”,
urlPatterns={”/myApp/*”})
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res)
{
...
@WebFilter( filterName="PaymentFilter",
urlPatterns={"/*"},
servletNames={"PaymentServlet"},
)
public class PaymentFilter implements Filter {
...
Modular war's
● Jar's in WEB-INF/lib can also contain annotated
servlet/filter/listener classes
● Jar's can also contribute META-INF/web.xml
● <web-fragment>...</web-fragment>
● Jar's can also contribute jsp's, static html
● In META-INF/resources
Servlet 3.0 and CDI
● If you have a WEB-INF/beans.xml, Web
archives will be scanned for Managed Beans
● Can be injected in servlets, JAX-RS, JSF beans
EJB CDI JPAJSF ...
@Stateful
@Stateless
@Singleton
@Produces
@Named @Entity
@Managed
Bean ...
EJB
Asynch Servlets
@WebServlet(name="AsyncServlet", asyncSupported=true)
public class AsyncServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response) {
final AsyncContext ac = request.startAsync();
ac.setTimeout(...)
ac.start( new Runnable(){
ac.getResponse().getWriter()...;
ac.complete();
});
Demo: Chat servlet
● Glassfish: asynch-request-war sample
JAX-RS 1.1
● RESTfull Web Services
● Typical use: javascript clients
● GET/POST/PUT/DELETE resources
● URL encodes resource identification
● Encoding defined by MIME headers
● Class and/or method annotated with @Path
● Automatic JSON/XML encoding using JAXB
Demo: novashop
● From Adam Bien hacks
● http://kenai.com/projects/javaee-patterns/sources/hg/show/hacks/NovaShop
● @Path, @PathParam, @Produces, @Consumes annotation on WorkshopRegistration
● Use Chrome Advanced Rest Client
JSF 2.0
● .xhtml view technology
● Uses JEE6 managed POJO’s
● @RequestScoped, @ConversationScoped, @Named
● New: call any method, even with parameters.
● Controllers: method calls on managed beans
● Bind form fields to bean properties
– Typically @RequestScoped beans
● Implicit navigation using method’s returned value
● Redirect after post: ?faces-redirect=true
JSF 2.0 in Java EE 6
● Supports javax.validation
● All @Named CDI beans are accessible
● Custom Components will use JAX-RS
Demo: novashop 2
● From Adam Bien hacks
● http://kenai.com/projects/javaee-patterns/sources/hg/show/hacks/NovaShop
● Index.xhtml, registered.xhtml
JSR-330 a.k.a. javax.inject
● @Inject, @Qualifier, @Scope, etc.
● Standardized Dependency Injection API
● Reference Implementation: Google Guice 2.0
● Also supported by Spring since 3.0
● Defines API, not injector implementation or
configuration
JSR-299 a.k.a. CDI
● Standardized dependency injection behaviour
and configuration
● Required feature of any Java EE 6 container,
including Web profile
● javax.enterprise.* package
● @Produces (evt. with InjectionPoint)
● Instance<> and @Alternative
● Event<> and @Observes
Demo: novashop 3
● Configurator for maxNumberOfRegistrations
CDI Extensions
● CDI has Service Provider Interfaces
● Allows extensions drop-in
● http://groups.diigo.com/group/cdi-extensions
● Seam 3 and others
● https://github.com/CDISource/cdisource
● @Spring Spring to CDI bridge
● CDI to Spring: use JNDI Lookup.
Q & A

More Related Content

PPTX
Spring Framework Petclinic sample application
PDF
Dive into Play Framework
PDF
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
PDF
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
PDF
[스프링/Spring교육학원,자바교육,근로자교육,실업자교육추천학원_탑크리에듀]#6.스프링프레임워크 & 마이바티스 (Spring Framew...
PDF
Java Server Faces
PDF
MyFaces Extensions Validator Part 1 of 3
PDF
MyFaces Extensions Validator r4 news
Spring Framework Petclinic sample application
Dive into Play Framework
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
#30.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
[스프링/Spring교육학원,자바교육,근로자교육,실업자교육추천학원_탑크리에듀]#6.스프링프레임워크 & 마이바티스 (Spring Framew...
Java Server Faces
MyFaces Extensions Validator Part 1 of 3
MyFaces Extensions Validator r4 news

What's hot (6)

PDF
MyFaces Extensions Validator r3 News
PDF
MyFaces Extensions Validator 1.x.2 News
PDF
Lviv 2013 d7 vs d8
PDF
#29.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
PPT
Zend Framework 2 - PHPUnit
PDF
Introduction to Spring Boot
MyFaces Extensions Validator r3 News
MyFaces Extensions Validator 1.x.2 News
Lviv 2013 d7 vs d8
#29.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
Zend Framework 2 - PHPUnit
Introduction to Spring Boot
Ad

Viewers also liked (10)

PDF
Moving to Java EE 6 and CDI and away from the clutter
PDF
CDI and Seam 3: an Exciting New Landscape for Java EE Development
PDF
Java EE 6 CDI Integrates with Spring & JSF
PDF
Designing Java EE Applications in the Age of CDI
PDF
CDI, Weld and the future of Seam
PDF
What we can expect from Java 9 by Ivan Krylov
PDF
Introduction to cdi given at java one 2014
PDF
Extending Java EE with CDI and JBoss Forge
PDF
Java one 2015 [con3339]
PDF
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Moving to Java EE 6 and CDI and away from the clutter
CDI and Seam 3: an Exciting New Landscape for Java EE Development
Java EE 6 CDI Integrates with Spring & JSF
Designing Java EE Applications in the Age of CDI
CDI, Weld and the future of Seam
What we can expect from Java 9 by Ivan Krylov
Introduction to cdi given at java one 2014
Extending Java EE with CDI and JBoss Forge
Java one 2015 [con3339]
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Ad

Similar to Java EE 6 (20)

PDF
Overview of Java EE 6 by Roberto Chinnici at SFJUG
PDF
Vaadin with Java EE 7
PDF
Contextual Dependency Injection for Apachecon 2010
PDF
Java EE7 Demystified
PDF
Java EE 6 workshop at Dallas Tech Fest 2011
PDF
Vaadin 7 - Java Enterprise Edition integration
PPTX
Go Fullstack: JSF for Public Sites (CONFESS 2013)
ODP
OTN Developer Days - Java EE 6
PDF
Andrei Niculae - JavaEE6 - 24mai2011
PDF
CDI Best Practices with Real-Life Examples - TUT3287
PDF
Java EE 8 Web Frameworks: A Look at JSF vs MVC
PDF
NLOUG 2018 - Future of JSF and ADF
PDF
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
PPTX
Java EE vs Spring Framework
PDF
50 features of Java EE 7 in 50 minutes at Geecon 2014
PDF
Jakarta EE: The First Parts
PDF
Jakarta EE : The First Parts
ODP
JBoss AS7 OSDC 2011
PDF
S313557 java ee_programming_model_explained_dochez
PDF
Java EE 8: On the Horizon
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Vaadin with Java EE 7
Contextual Dependency Injection for Apachecon 2010
Java EE7 Demystified
Java EE 6 workshop at Dallas Tech Fest 2011
Vaadin 7 - Java Enterprise Edition integration
Go Fullstack: JSF for Public Sites (CONFESS 2013)
OTN Developer Days - Java EE 6
Andrei Niculae - JavaEE6 - 24mai2011
CDI Best Practices with Real-Life Examples - TUT3287
Java EE 8 Web Frameworks: A Look at JSF vs MVC
NLOUG 2018 - Future of JSF and ADF
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE vs Spring Framework
50 features of Java EE 7 in 50 minutes at Geecon 2014
Jakarta EE: The First Parts
Jakarta EE : The First Parts
JBoss AS7 OSDC 2011
S313557 java ee_programming_model_explained_dochez
Java EE 8: On the Horizon

More from Geert Pante (11)

PPTX
OAuth2 and OpenID with Spring Boot
PPTX
Kafka Introduction.pptx
PDF
Kubernetes and Amazon ECS
PDF
Docker in practice
PPTX
Spring JMS and ActiveMQ
PPTX
Log management with ELK
PPTX
Spring 4 en spring data
PPT
Spring and SOA (2006)
PPTX
Maven plugins, properties en profiles: Advanced concepts in Maven
PPTX
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
PPTX
Version Management in Maven
OAuth2 and OpenID with Spring Boot
Kafka Introduction.pptx
Kubernetes and Amazon ECS
Docker in practice
Spring JMS and ActiveMQ
Log management with ELK
Spring 4 en spring data
Spring and SOA (2006)
Maven plugins, properties en profiles: Advanced concepts in Maven
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
Version Management in Maven

Recently uploaded (20)

PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
AI in Product Development-omnex systems
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Transform Your Business with a Software ERP System
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Reimagine Home Health with the Power of Agentic AI​
Design an Analysis of Algorithms I-SECS-1021-03
Odoo Companies in India – Driving Business Transformation.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
AI in Product Development-omnex systems
CHAPTER 2 - PM Management and IT Context
Softaken Excel to vCard Converter Software.pdf
Digital Strategies for Manufacturing Companies
Odoo POS Development Services by CandidRoot Solutions
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How Creative Agencies Leverage Project Management Software.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Wondershare Filmora 15 Crack With Activation Key [2025
Transform Your Business with a Software ERP System
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Reimagine Home Health with the Power of Agentic AI​

Java EE 6

  • 1. Java EE 6 All Platform, no clutter @greyfairer
  • 2. Agenda Servlet 3.0, JAX-RS 1.1, JSF 2.0 JSR-330 a.k.a. javax.inject JSR-299 a.k.a. CDI Arquillian CDI Extensions
  • 3. Servlets 3.0 @WebServlet(name=”MyServlet”, urlPatterns={”/myApp/*”}) public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { ... @WebFilter( filterName="PaymentFilter", urlPatterns={"/*"}, servletNames={"PaymentServlet"}, ) public class PaymentFilter implements Filter { ...
  • 4. Modular war's ● Jar's in WEB-INF/lib can also contain annotated servlet/filter/listener classes ● Jar's can also contribute META-INF/web.xml ● <web-fragment>...</web-fragment> ● Jar's can also contribute jsp's, static html ● In META-INF/resources
  • 5. Servlet 3.0 and CDI ● If you have a WEB-INF/beans.xml, Web archives will be scanned for Managed Beans ● Can be injected in servlets, JAX-RS, JSF beans EJB CDI JPAJSF ... @Stateful @Stateless @Singleton @Produces @Named @Entity @Managed Bean ... EJB
  • 6. Asynch Servlets @WebServlet(name="AsyncServlet", asyncSupported=true) public class AsyncServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) { final AsyncContext ac = request.startAsync(); ac.setTimeout(...) ac.start( new Runnable(){ ac.getResponse().getWriter()...; ac.complete(); });
  • 7. Demo: Chat servlet ● Glassfish: asynch-request-war sample
  • 8. JAX-RS 1.1 ● RESTfull Web Services ● Typical use: javascript clients ● GET/POST/PUT/DELETE resources ● URL encodes resource identification ● Encoding defined by MIME headers ● Class and/or method annotated with @Path ● Automatic JSON/XML encoding using JAXB
  • 9. Demo: novashop ● From Adam Bien hacks ● http://kenai.com/projects/javaee-patterns/sources/hg/show/hacks/NovaShop ● @Path, @PathParam, @Produces, @Consumes annotation on WorkshopRegistration ● Use Chrome Advanced Rest Client
  • 10. JSF 2.0 ● .xhtml view technology ● Uses JEE6 managed POJO’s ● @RequestScoped, @ConversationScoped, @Named ● New: call any method, even with parameters. ● Controllers: method calls on managed beans ● Bind form fields to bean properties – Typically @RequestScoped beans ● Implicit navigation using method’s returned value ● Redirect after post: ?faces-redirect=true
  • 11. JSF 2.0 in Java EE 6 ● Supports javax.validation ● All @Named CDI beans are accessible ● Custom Components will use JAX-RS
  • 12. Demo: novashop 2 ● From Adam Bien hacks ● http://kenai.com/projects/javaee-patterns/sources/hg/show/hacks/NovaShop ● Index.xhtml, registered.xhtml
  • 13. JSR-330 a.k.a. javax.inject ● @Inject, @Qualifier, @Scope, etc. ● Standardized Dependency Injection API ● Reference Implementation: Google Guice 2.0 ● Also supported by Spring since 3.0 ● Defines API, not injector implementation or configuration
  • 14. JSR-299 a.k.a. CDI ● Standardized dependency injection behaviour and configuration ● Required feature of any Java EE 6 container, including Web profile ● javax.enterprise.* package ● @Produces (evt. with InjectionPoint) ● Instance<> and @Alternative ● Event<> and @Observes
  • 15. Demo: novashop 3 ● Configurator for maxNumberOfRegistrations
  • 16. CDI Extensions ● CDI has Service Provider Interfaces ● Allows extensions drop-in ● http://groups.diigo.com/group/cdi-extensions ● Seam 3 and others ● https://github.com/CDISource/cdisource ● @Spring Spring to CDI bridge ● CDI to Spring: use JNDI Lookup.
  • 17. Q & A