www.arshal.org

A new wave of

JEE & JSF

Arshal (@aforarsh)
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

www.arshal.org
Before we start !

❖

www.arshal.org

Download code

http://bit.ly/18FJHh7

http://www.arshal.org/2013/12/talk-at-oracle.h...
Before we start !

www.arshal.org
Coming back..
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3....
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
JSF 2.2
❖

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

❖

Components!

❖

...
JSF 2.2
❖

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

❖

Components!

❖

...
JSF 2.2
❖

www.arshal.org

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

❖

...
JSF 2.2
❖

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

❖

Components!

❖

...
JSF 2.2
❖

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

❖

Components!

❖

...
JSF 2.2
❖

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

!❖
❖

Components!
C...
JSF 2.2
❖

Pass through attributes!

❖

Flow scoped!

❖

Resource library contracts!

❖

File upload!

❖

www.arshal.org

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
CDI 1.1

❖

Bean discovery mode!

❖

Vetoed beans

www.arshal.org
CDI 1.1

❖

Bean discovery mode!

❖

Vetoed beans

www.arshal.org

bean-discovery-mode=“all"!
bean-discovery-mode=“annotat...
CDI 1.1

❖

Bean discovery mode!

❖

Vetoed beans

@Vetoed

www.arshal.org
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Bean Validation 1.1

❖

Custom constraints!
@NotNull(message = "{org.sample.zipcode.cannot_be_null}")!
!
public @interface...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Interceptors

www.arshal.org

❖

InterceptorBinding!

❖

@AroundConstruct!

❖

Prioritisation standard!

❖

@Priority(Inte...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
`
❖

Transactional scoped beans!
❖

❖

www.arshal.org

@TransactionScoped!

Transactional methods!
❖

@Transactional(value...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
EJB 3.2
❖

Asynchronous bean!
❖

❖

@Asynchronous!

Non persistent timer service!
❖

❖

www.arshal.org

@Schedule(hour="*"...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Agenda
❖

JSF 2.2!

❖

CDI 1.1!

❖

Bean validation 1.1!

❖

Interceptors!

❖

JTA 1.2!

❖

EJB 3.2!

❖

Servlet 3.1!

❖

...
Q&A

❖

Contact Info!
❖

e-mail: aforarsham@gmail.com!

❖

Twitter: @aforarsh!

❖

Web: www.arshal.org

www.arshal.org
“ Good code is its own best documentation. As
you're about to add a comment, ask yourself,
"How can I improve the code so ...
Upcoming SlideShare
Loading in …5
×

Oracle talk 20131213

12,463 views

Published on

Slides of talk at Japan Java Users Group on 2013/12/13 on JEE7.
Download source code at http://www.arshal.org/2013/12/talk-at-oracle.html

Published in: Technology
  • Be the first to comment

Oracle talk 20131213

  1. 1. www.arshal.org A new wave of JEE & JSF Arshal (@aforarsh)
  2. 2. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  3. 3. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  4. 4. Before we start ! www.arshal.org
  5. 5. Before we start ! www.arshal.org
  6. 6. Before we start ! www.arshal.org
  7. 7. Before we start ! www.arshal.org
  8. 8. Before we start ! www.arshal.org
  9. 9. Before we start ! www.arshal.org
  10. 10. Before we start ! www.arshal.org
  11. 11. Before we start ! www.arshal.org
  12. 12. Before we start ! www.arshal.org
  13. 13. Before we start ! www.arshal.org
  14. 14. Before we start ! www.arshal.org
  15. 15. Before we start ! ❖ www.arshal.org Download code
 http://bit.ly/18FJHh7
 http://www.arshal.org/2013/12/talk-at-oracle.html
  16. 16. Before we start ! www.arshal.org
  17. 17. Coming back.. ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  18. 18. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  19. 19. JSF 2.2 ❖ Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! ❖ Components! ❖ CSRF www.arshal.org
  20. 20. JSF 2.2 ❖ Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! ❖ Components! ❖ CSRF www.arshal.org <h:inputText value="#{passthroughBean.age}" p:type="number"/>
  21. 21. JSF 2.2 ❖ www.arshal.org Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! ❖ Components ! ❖ CSRF @FlowScoped(“flow1")! @FlowDefinition! flow.xml
  22. 22. JSF 2.2 ❖ Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! ❖ Components! ❖ CSRF www.arshal.org <f:view contracts="#{contractsBean.contract}">
  23. 23. JSF 2.2 ❖ Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! ❖ Components! ❖ CSRF www.arshal.org <h:inputFile value="#{fileUploadBean.file}"/>
  24. 24. JSF 2.2 ❖ Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! !❖ ❖ Components! CSRF www.arshal.org
  25. 25. JSF 2.2 ❖ Pass through attributes! ❖ Flow scoped! ❖ Resource library contracts! ❖ File upload! ❖ www.arshal.org Components! !❖ CSRF <protected-views>! <url-pattern>/jsf/file/index.xhtml</url-pattern>! </protected-views>
  26. 26. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  27. 27. CDI 1.1 ❖ Bean discovery mode! ❖ Vetoed beans www.arshal.org
  28. 28. CDI 1.1 ❖ Bean discovery mode! ❖ Vetoed beans www.arshal.org bean-discovery-mode=“all"! bean-discovery-mode=“annotated”! bean-discovery-mode="none"
  29. 29. CDI 1.1 ❖ Bean discovery mode! ❖ Vetoed beans @Vetoed www.arshal.org
  30. 30. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  31. 31. Bean Validation 1.1 ❖ Custom constraints! @NotNull(message = "{org.sample.zipcode.cannot_be_null}")! ! public @interface ZipCode { ❖ Method validation public String saveZip(@ZipCode String zip) www.arshal.org
  32. 32. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  33. 33. Interceptors www.arshal.org ❖ InterceptorBinding! ❖ @AroundConstruct! ❖ Prioritisation standard! ❖ @Priority(Interceptor.Priority.APPLICATION+10), @Interceptors
  34. 34. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  35. 35. ` ❖ Transactional scoped beans! ❖ ❖ www.arshal.org @TransactionScoped! Transactional methods! ❖ @Transactional(value=Transactional.txType.Required, rollbackOn={SQLException.class, JMSException.class},  dontRollbackOn=SQLWarning.class)
  36. 36. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  37. 37. EJB 3.2 ❖ Asynchronous bean! ❖ ❖ @Asynchronous! Non persistent timer service! ❖ ❖ www.arshal.org @Schedule(hour="*", minute="*", second="*/5", info = "Every 5 second timer", persistent = false) ! Passivation capable! ❖ @PrePassivate
  38. 38. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  39. 39. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! • ❖ JSONP! • ❖ Batch Processing www.arshal.org • Non blocking I/O: Check for resource availability before trying for it.
 while (input.isReady()
 && (len = input.read(b)) != -1) { String data = new String(b, 0, len); System.out.println("--> " + data)
 }! Improved security! Async supported
 @WebServlet(urlPatterns="/async", asyncSupported=true)!
  40. 40. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org
  41. 41. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ JSONP! ❖ Batch Processing <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance" xsi:schemaLocation=“http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/ persistence/persistence_2_1.xsd"> 
 <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>
 </persistence> JAX - RS 2.0! ❖ Schema generation! • Expression Language 3.0! ❖ www.arshal.org Bulk update/delete using criteria API
 • ! • CriteriaBuilder builder = em.getCriteriaBuilder();! CriteriaDelete deleteCriteria = builder.createCriteriaDelete(Student.class); Root<Student> updateRoot = deleteCriteria.from(Student.class); deleteCriteria.where(builder.equal(updateRoot.get(Student_.id), "1234")); Query q = em.createQuery(deleteCriteria); q.executeUpdate(); Unsynchronized persistence contexts
 @PersistenceContext(synchronization=SynchronizationType.UNSYNCHRONIZED)!
  42. 42. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Expression Language 3.0! ❖ Web socket 1.1! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org • • • Simplified! Easier resource configuration! JMS resource definition annotations.
  43. 43. Agenda ❖ JSF 2.2! ❖ CDI 1.1! ❖ Bean validation 1.1! ❖ Interceptors! ❖ JTA 1.2! ❖ EJB 3.2! ❖ Servlet 3.1! ❖ JPA! ❖ JMS 2.0! ❖ Web socket 1.1! ❖ Expression Language 3.0! ❖ JAX - RS 2.0! ❖ JSONP! ❖ Batch Processing www.arshal.org • Lambda expression support
  44. 44. Q&A ❖ Contact Info! ❖ e-mail: aforarsham@gmail.com! ❖ Twitter: @aforarsh! ❖ Web: www.arshal.org www.arshal.org
  45. 45. “ Good code is its own best documentation. As you're about to add a comment, ask yourself, "How can I improve the code so that this comment isn't needed?" Improve the code and then document it to make it even clearer.”

×