What's Up With Java EE 8 ? (Part 2)
What's Up With Java EE 8 ? (Part 2)
Join the DZone community and get the full member experience.Join For Free
Secure your Java app or API service quickly and easily with Okta's user authentication and authorization libraries. Developer accounts are free forever. Try Okta Instead.
Work on Java EE 8 is still in the initial phases and expected to catch pace in the upcoming year wherein we would see completion of Expert Group formation, more discussions around use cases/features, lots of JIRAs, and draft versions of various specifications (this would be quite interesting!).
In part 1, we looked at the new specs which are in the pipeline for inclusion in Java EE 8. In this post, let’s glance through the existing specifications which are lined up for further enhancements (which are quite significant!)
List of updated specifications
- CDI 2.0 (JSR 365)
- JAX-RS 2.1 (JSR 370)
- Servlet 4.0 (JSR 369)
- JSON-P 1.1 (JSR 374)
- JMS 2.1 (JSR 368)
- Java EE Management 2.0 (JSR 373)
- JSF 2.3 (JSR 372)
Let’s look at them one by one….
CDI 2.0 (JSR 365)
Since its inception in Java EE 6, CDI has become and indispensable part of the Java EE Platform. The resounding success of CDI has resulted in community demand for further tightening its integration with the different specifications in the Platform. Check out pages 5-7 of the Java EE 8 Community survey results
- Alignment with Java SE 8 (of course!) – Leverage Java 8 goodies such as Lambdas, Streams, Repeatable Annotations, Default Methods etc
- Support for Java SE – Standardizing a Dependency Injection API for Java SE. Individual CDI implementations (Weld etc) do have support for Java SE but one needs to resort to vendor specific ways in order to work with these. This would hopefully be resolved and we will have a standard API for working with CDI on Java SE and EE !
- CDI Modularity – splitting up CDI into easily manageable modules to make things easier both from a maintenance as well as adoption/implementation perspective
- Enhanced Events – one of the major enhancements is introduction of Asynchronous Events which was not there up until now (CDI 1.2).
- Other features – AOP (interceptor & decorators) and SPI related enhancements
It is still very early days and nothing is set in stone as of yet. Things are evolving and will continue to do so. All the latest updates can be accessed on the official CDI spec page.
Here is a blog post which I had posted few days back with some more details about CDI 2.0.
- JCP page
- Reference Implementation – JBoss Weld
- Latest talk at JavaOne 2014 – This is CDI 1.2 centric
JAX-RS 2.1 (JSR 370)
With the kind of goals and features in pipeline, I am surprised that this revision is being referred to as 2.1 – it could well have been 3.0, but that’s just a general opinion which I have.
Plans for EE 8
- Tighter integration with CDI
- Support for Server Sent Events (SSE) – Inclusion of a standard API for Server Sent Events was well what the community had asked for as evident in page 2 of the Java EE 8 Community survey results. If you haven’t heard of or know about SSE, think of it as a middle path b/w HTTP (request-response based) and WebSockets (full duplexed and bi-directional).
- Integration with JSON-B – JSON-B is another Java EE 8 candidate which I had mentioned about in my previous post. Currently, JAX-RS provides seamless, out-of-the-box support for JAXB. The same is being planned for JSON-B. All you would need to is define your model classes with JSON-B annotations and leave the rest to the JAX-RS run time!
- Explicit support for Security – Securing RESTful services has always been a talking point. JAX-RS does not support a standard way for declarative or programmatic security, although standard Java EE web (servlet) and business (EJB) layer security can still be applied. But the goal here will be either to standardize JAX-RS specific security features or leverage Java EE Security 1.0 (JSR 375) (another Java EE 8 candidate)
- Enabling NIO (non blocking I/O) for JAX-RS providers. This is to complement the already existing Async (server & client) capabilities available since JAX-RS 2.0
- Other features in the pipeline include support for reactive programming via JAX-RS, improving the Hypermedia API (HATEOAS) introduced in JAX-RS 2.0 and supporting
- Official JCP page
- Reference Implementation – Jersey
- Let’s Talk JAX-RS.next!
- Java One 2014 talk about latest Jersey features – another Java One 2014 goodie!
Servlet 4.0 (JSR 369)
Servlets are one the oldest and the most important specifications in Java EE. Several other specs (JAX-RS, WebSockets etc) are built on top of it. Servlet 4.0 is going to be dedicated to HTTP/2. It primary goal is to empower the Servlet API with HTTP/2 features.
- Request/Response multiplexing
- Stream Prioritization
- Server Push
- Upgrade from HTTP 1.1 – Use the existing upgrade feature (from HTTP to Web sockets) in the API to enable upgrade to HTTP/2
- Official JCP page
- Talk at Java One 2014 – HTTP 2.0 Comes to Java: What Servlet 4.0 Means to You
- Another one from Java One 2014 Into the Wild with Servlet Async IO – this is geared towards Servlet 3.1
JSON-P 1.1 (JSR 374)
JSON-P 1.0 was introduced in Java EE 7 and provided a standard API for developers to deal with JSON without having to package 3rd party implementations. This helped Java EE 7 truly align with HTML5 standards (one of its key themes). JSON-P 1.1 is more of a maintenance release with fixes and improvements.
What’s planned for Java EE 8?
- Alignment with Java SE 8 – Although the goal is an obvious one, it is interesting nonetheless. The API might be enhanced to use Java 8 Collectors along with providing a Stream representation of JSON parser events.
- Incorporate support for updates to the JSON spec itself – JSON Pointer and JSON Patch
- Support for modifying (previously immutable) JSON objects (possibly via a Builder like implementation)
JMS 2.1 (JSR 368)
JMS 2.0 (JSR 343) ushered in huge improvements particularly in simplification of the API itslef. The result was ease of use and developer productivity – one of the central themes of Java EE 7. JMS 2.1 plans to introduce a couple significant changes/additions along with some regular improvements – let’s take a look
- Alignment with Java SE 8 – not a surprising one in my opinion (repeatable annotations, lambdas etc)
- Change in the asynchronous messaging approach (search for alternate ideas) – The plan is to extend the idea of an MDB to any CDI bean in general and remove constraints of having to implement the MessageListener interface. Any CDI bean can act receive messages in an async fashion.
- Miscellaneous improvements such as JMS Provider behavior when used within a Java EE transaction, portability of JMS providers with Java EE app servers, redelivery of messages in case of exceptions being thrown from the MDB
Bearing in mind that CDI 2.0 will also have support for async events, it would be interesting to see how these two specifications deal with feature which deals with async event/message handling in general. Also, it needs to be seen whether or not this particular feature ends up making MDBs obsolete.
Java EE Management 2.0 (JSR 373)
Simply put, this JSR aims at being the modern counterpart for J2EE Management specification (JSR 77). REST is very synonymous with modernization and the Java EE Management JSR plans to adopt REST as the de-facto interface for communicating with managed objects and providing functionality such as
- Expose CRUD operations on the managed objects as RESTful interfaces
- Leverage SSE to distribute events in response to change in the managed object state
- Enable deployment of Java EE applications using REST interface (deployment and management via the same interface) – quite different as compared to JSR 88 which also deals with Java EE application deployment
As of now, things are kind of quiet from a work perspective. But I am pretty sure that we will be in for a lot of action in the new year!
JSF 2.3 (JSR 372)
Looks like JSF 2.3 is going to be driven by community inputs and feedback. Check pages 3,4,5 of the Java EE 8 Community survey results to see feedback w.r.t JSF around MVC as well as a templating engine.
- Leverage Java SE 8 as well as other features from the Java EE 8 Platform itself
- Enhancement to the JSF Ajax API in order to enable direct Ajax calls to CDI Managed (Controller) beans (this sounds promising !) which would make it simple to exchange JSON messages b/w client and Java EE backend
- Incorporate features which are in high demand by the JSF user community – EL performance improvements, multi-field validation etc
- Supporting MVC 1.0 – JSF has a lot to offer to the ‘V’ (view) part of MVC (Facelets, faces flow, JSF CDI scopes etc). It would be interesting to look at what changes/additions would be made to JSF w.r.t MVC 1.0
Is that all as far as Java EE 8 goodies are concerned? Certainly not. Other specifications are also due for revamp and improvements – they would be in the limelight pretty soon. Here is a quick overview of other specs and what’s expected
- EJB 3.2 (maintenance release)
- JPA 2.1 (maintenance release – support for Java 8 DateTime API and Repeating Annotations)
- WebSocket 1.0 (maintenance release)
- JTA and Java Mail specs might be lined up for maintenance release as well
More on the Java EE 8 Expert Group email discussion
Java EE 8 is just beginning to warm up. I am pretty sure that the ride is going to be exciting! Stay tuned….
Cheers ! :-)
Published at DZone with permission of Abhishek Gupta , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.