TechTip: Six New Things You May Not Know About Java EE 7

Java
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Learn about some of the key new features in the highly anticipated release of Oracle's Java EE (Enterprise Edition) 7 and see how they can help you create modern-day Web applications.

 

Java EE 7 was released in June 2013, and it represents the latest major release of the Java EE platform, which has certainly come a long way since the early days of J2EE. Java EE's focus has always been on simplifying server-side enterprise applications, allowing developers to focus on the application business logic rather than on non-business-relevant "boilerplate" code.

 

Some would argue that Java EE is nothing more than an over-architected, unwieldy "hog" of sorts; and in the early days, that would have been hard to dispute. However, as things have evolved over the years, there has been a paradigm shift to make things easier for the developer—and now with the new and exciting features in Java EE 7, developing reliable and scalable Java enterprise applications couldn't be easier!

Key New Technologies

Let's take a quick peek at some of the new technologies introduced in Java EE 7.

 

1. WebSocket 1.0

Interactive websites are expected nowadays, and technology standards such as HTML5 pave the way of the future. WebSocket 1.0 (JSR 356) is an API that helps promote timely responses from central servers and avoids the latency pitfalls of HTTP-based solutions such as long-polling and HTTP streaming. It's a TCP-based, full-duplex, bi-directional  messaging system that's supported by "recent" releases of most major web browsers. And best of all, the WebSocket API is essentially realized through an annotated plain old Java object (POJO), so implementing this technology is downright simple!

 

2. JSON Processing (JSON-P)

JSON—it's one of the de facto standards for data exchange. So why doesn't Java EE come with an "out-of-the-box" solution for reading and writing JSON?! Wait no more—Java EE 7 introduces native support for such operations (and it's about time!) through the use of JsonBuilder (DOM-based) or JsonGenerator (streaming). This will inherently increase applications' portability as they need not rely on third-party libraries. And for you developers who still want to provide your own custom parsers, you're still granted that flexibility should you have some specific reason to do so.

 

3. Batch Applications

While it's fairly common to have some batch processing occur as part of your overall application workflow, there has never been any standard Java programming model to facilitate such processing—until now. Java EE 7 introduces a convenient framework within which a job can be described by the Job Specification Language (JSL), which is written in XML. A "job" can be sub-divided into a series of optional "steps" that are transactional in nature. A job is then invoked by a "job operator," which stores information about the job's execution in the "job repository." Over time, these new "out-of-the-box" batch processing constructs will lead to a whole new level of application simplicity and portability.

Other Noteworthy Enhancements

While not necessarily new technology, several packages have undergone some major cosmetic surgery; let's take a look at some examples.

 

4. JSF 2.2

Java Server Faces (JSF) is naturally a framework used for building portable web applications. Java EE 7 requires the usage of JSF 2.2, whose most noteworthy feature is HTML5-friendly markup.

 

5. JMS 2.0

JMS hasn't really seen any major enhancements since the early 2000s when JMS 1.1 was released. The team responsible for JMS 2.0 has gone to great lengths to simplify the code necessary to produce and consume messages. For example, JMS 2.0 introduces the JMSContext object, which eliminates the need to work with both the Connection and Session objects, ultimately leading to a one-liner to send a message:

 

context.createProducer().send(Queue yourQueue, String yourPayload)

 

It doesn't get much easier than that, now does it?

 

6. JAX-RS 2.0

JAX-RS 2.0 is critically important in terms of satisfying modern-day scalability demands; it was designed with satisfying the (heavy) demands of HTML5 clients. Most notably, JAX-RS 2.0 introduces support for asynchronous client- and server-side processing. This means far better responsiveness, particularly when calling out to external tasks as threads need not be blocked in the interim waiting for responses.

Stitching the Pieces Together

While there is undoubtedly a swarm of other features delivered with Java EE 7, your eyes have been opened to some of the more notable ones. As you're working on building your next Java EE application (or likely revamping an existing application), I encourage you to consider these features as you evaluate your requirements; you may find that these new capabilities save you weeks of time (i.e., by eliminating boilerplate code), and they could be the difference in whether your application feels "modern" or "archaic."

 

And the best part—you can start experimenting with Java EE 7 right now! Eclipse 4.3 (codename "Kepler") and Apache Tomcat 8.0 (as well as many other application servers) have already introduced support for Java EE 7, so now there's absolutely nothing standing in your way (except those dreaded work deadlines) of experimenting with Java EE 7.

 

Happy coding!


 

BLOG COMMENTS POWERED BY DISQUS