<Insert Picture Here>




An Overview of the Java EE 6 Platform
Roberto Chinnici
Java EE Platform Lead
The following is intended to outline our general
product direction. It is intended for information
purposes only, and may ...
Agenda


•   What's new in Java EE 6?
•   Web Profile
•   Extensibility
•   Highlights from some of the new APIs
<Insert Picture Here>



Java EE 6 Platform
JAVA EE 6
  FINAL RELEASE
DECEMBER 10, 2009
What's New?


•   Several new APIs
•   Web Profile
•   Pluggability/extensibility
•   Dependency injection
•   Lots of imp...
New and updated components


•   EJB 3.1               •   Managed Beans 1.0
•   JPA 2.0               •   Interceptors 1....
Web Profile


• First Java EE profile to be defined
• A fully-functional, mid-size stack for modern web
  application deve...
Java EE 6 Web Profile Contents


                      JSF 2.0

     JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0

           ...
Java EE 6 Web Profile Extension Points


                       JSF 2.0

      JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0

 ...
Pluggability/Extensibility


• Focus on the web tier in this release
• Create a level playing field for third-party framew...
Modular Web Applications


•   Libraries can contain /META-INF/web-fragment.xml
•   web.xml is optional
•   @WebServlet, @...
Sample Servlet

import javax.servlet.annotation.WebServlet;

@WebServlet(urlPatterns=”/contents”)
public class MyServlet e...
Sample Web Fragment Descriptor

<web-fragment
     version=”3.0”
     xmlns="http://java.sun.com/xml/ns/javaee">
  <servle...
Strategy for Evolving the APIs


•   Capture common patterns
•   Fix inconsistencies
•   Adopt what works
•   Make APIs wo...
JAX-RS 1.1


•   RESTful web services API
•   Already widely adopted
•   Really a general, high-level HTTP API
•   Annotat...
JAX-RS Sample

@Path(“widgets/{id}”)
@Consumes(“application/widgets+xml”)
@Produces(“application/widgets+xml”)
public clas...
Building HTTP Responses



return Response.created(createdUri)
               .entity(createdContent)
               .buil...
EJB 3.1


• @Singleton beans
• @Startup beans
• Declarative timers
• Asynchronous method calls
   @Asynchronous public Fut...
EJB 3.1 Code Snippets
@Singleton @Startup
public class StartupBean {
  @PostConstruct
  public void doAtStartup() { … }
}
...
EJB 3.1 Lite


•   A subset of EJB 3.1
•   All types of session beans (stateful, stateless, singletons)
•   Local access o...
Java EE 6 Web Profile Core Component Model


                      JSF 2.0

      JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0...
Dependency Injection


• DI + CDI (JSR-330 + JSR-299)
• @Resource still around for container resources
  @Resource DataSou...
Scoped Bean with Constructor Injection


@ApplicationScoped
public class CheckoutHandler {
  @Inject
  public CheckoutHand...
Why Use CDI?


• Structure the application as a set of beans
• Injection and events enable decoupling
  – No direct depend...
Java EE 6 Platform


•   More powerful
•   More flexible
•   More extensible
•   Easier to use




      http://www.oracle...
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Upcoming SlideShare
Loading in...5
×

Overview of Java EE 6 by Roberto Chinnici at SFJUG

2,772

Published on

Roberto Chinnici, Java EE 6 spec lead, gives an overview of Java EE 6 for San Francisco Java User Group on August 10th, 2010.

http://www.sfjava.org/calendar/13940755/

Published in: Education
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,772
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
102
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Overview of Java EE 6 by Roberto Chinnici at SFJUG

  1. 1. <Insert Picture Here> An Overview of the Java EE 6 Platform Roberto Chinnici Java EE Platform Lead
  2. 2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  3. 3. Agenda • What's new in Java EE 6? • Web Profile • Extensibility • Highlights from some of the new APIs
  4. 4. <Insert Picture Here> Java EE 6 Platform
  5. 5. JAVA EE 6 FINAL RELEASE DECEMBER 10, 2009
  6. 6. What's New? • Several new APIs • Web Profile • Pluggability/extensibility • Dependency injection • Lots of improvements to existing APIs
  7. 7. New and updated components • EJB 3.1 • Managed Beans 1.0 • JPA 2.0 • Interceptors 1.1 • Servlet 3.0 • JAX-WS 2.2 • JSF 2.0 • JSR-109 1.3 • JAX-RS 1.1 • JSP 2.2 • Connectors 1.6 • EL 2.2 • Bean Validation 1.0 • JSR-250 1.1 • DI 1.0 • JASPIC 1.1 • CDI 1.0 • JACC 1.5
  8. 8. Web Profile • First Java EE profile to be defined • A fully-functional, mid-size stack for modern web application development • Complete, but not the kitchen sink
  9. 9. Java EE 6 Web Profile Contents JSF 2.0 JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0 Servlet 3.0 EJB 3.1 Lite · DI 1.0 · CDI 1.0 · Managed Beans 1.0 Bean Validation 1.0 · Interceptors 1.1 · JSR-250 1.1 JPA 2.0 · JTA 1.1
  10. 10. Java EE 6 Web Profile Extension Points JSF 2.0 JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0 Servlet 3.0 EJB 3.1 Lite · DI 1.0 · CDI 1.0 · Managed Beans 1.0 Bean Validation 1.0 · Interceptors 1.1 · JSR-250 1.1 JPA 2.0 · JTA 1.1
  11. 11. Pluggability/Extensibility • Focus on the web tier in this release • Create a level playing field for third-party frameworks • Simplify packaging of web applications
  12. 12. Modular Web Applications • Libraries can contain /META-INF/web-fragment.xml • web.xml is optional • @WebServlet, @WebFilter annotations • ServletContainerInitializer interface • Programmatic registration of components • Resource jars containing /META-INF/resources /WEB-INF/lib/catalog.jar /META-INF/resources/catalog/books.html → http://myserver:8080/myapp/catalog/books.html
  13. 13. Sample Servlet import javax.servlet.annotation.WebServlet; @WebServlet(urlPatterns=”/contents”) public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) { // ... } } No deployment descriptor needed
  14. 14. Sample Web Fragment Descriptor <web-fragment version=”3.0” xmlns="http://java.sun.com/xml/ns/javaee"> <servlet> <servlet-name>welcome</servlet-name> <servlet-class>WelcomeServlet</servlet-class> </servlet> <listener> <listener-class>RequestListener</listener-class> </listener> </web-fragment>
  15. 15. Strategy for Evolving the APIs • Capture common patterns • Fix inconsistencies • Adopt what works • Make APIs work better together • Reducing boilerplate/packaging • Be transparent
  16. 16. JAX-RS 1.1 • RESTful web services API • Already widely adopted • Really a general, high-level HTTP API • Annotation-based programming model • Programmatic API when needed
  17. 17. JAX-RS Sample @Path(“widgets/{id}”) @Consumes(“application/widgets+xml”) @Produces(“application/widgets+xml”) public class WidgetResource { public WidgetResource(@PathParam(“id”) String id) {…} @GET public Widget getWidget() {…} @PUT public void putWidget(Widget widget){…} }
  18. 18. Building HTTP Responses return Response.created(createdUri) .entity(createdContent) .build(); return Response.status(404) .entity(message) .type("text/plain") .build(); Similarly, use UriBuilder to build URIs
  19. 19. EJB 3.1 • @Singleton beans • @Startup beans • Declarative timers • Asynchronous method calls @Asynchronous public Future<Integer> compute(); • Define EJBs directly inside a web application • EJBContainer API works on Java SE
  20. 20. EJB 3.1 Code Snippets @Singleton @Startup public class StartupBean { @PostConstruct public void doAtStartup() { … } } @Stateless public class BackupBean { @Schedule(dayOfWeek=”Fri”, hour=”3”, minute=”15”) public void performBackup() { … } } @Stateless public class CacheRefreshingBean { @Schedule(minute=”*/5”, persistent=false) public void refreshCache() { … } }
  21. 21. EJB 3.1 Lite • A subset of EJB 3.1 • All types of session beans (stateful, stateless, singletons) • Local access only • Declarative transactions and security • Interceptors • ejb-jar.xml descriptor optional
  22. 22. Java EE 6 Web Profile Core Component Model JSF 2.0 JSP 2.2 · EL 2.2 · JSTL 1.2 · JSR-45 1.0 Servlet 3.0 EJB 3.1 Lite · DI 1.0 · CDI 1.0 · Managed Beans 1.0 Bean Validation 1.0 · Interceptors 1.1 · JSR-250 1.1 JPA 2.0 · JTA 1.1
  23. 23. Dependency Injection • DI + CDI (JSR-330 + JSR-299) • @Resource still around for container resources @Resource DataSource myDB; • Added @Inject annotation for type-safe injection @Inject @LoggedIn User user; • Automatic scope management (request, session, etc.) • No configuration: beans discovered at startup • Extensible via the BeanManager API
  24. 24. Scoped Bean with Constructor Injection @ApplicationScoped public class CheckoutHandler { @Inject public CheckoutHandler( @LoggedIn User user, @Reliable @PayBy(CREDIT_CARD) PaymentProcessor processor, @Default ShoppingCart cart) {…} } Injection points identified by Qualifier + Type @Default qualifier can be omitted
  25. 25. Why Use CDI? • Structure the application as a set of beans • Injection and events enable decoupling – No direct dependency between beans – Freedom to refactor the code, change implementations • Automatic state management base on scope • Support EJB components and plain “managed beans” • Beans discovered automatically - no configuration needed • Extensible notion of bean – Can incorporate components from external frameworks
  26. 26. Java EE 6 Platform • More powerful • More flexible • More extensible • Easier to use http://www.oracle.com/javaee
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×