Tuesday Aug 25, 2015

Asynchronous Support in JAX-RS 2/Java EE 7

Asynchronous processing, non-blocking I/O, events and messaging are keys to more reactive applications. Fortunately Java EE has long organically provided such features in the platform at pretty much every key API layer including Servlet, CDI, EJB and JMS. These features were strengthened further in Java EE 7 and even more could be done in Java EE 8. Spurred by a real world developer I met at a conference writing a highly reactive IoT application with Java EE, I've actually developed a talk about reactive features in Java EE (click here if you can't see the embedded slide deck):

One such feature added in JAX-RS 2/Java EE 7 gets surprisingly little exposure - asynchronous capabilities added for both server-side REST endpoints as well as clients. Fortunately Sam Sepassi has stepped up nicely to fill the gap with a detailed blog entry that covers both the servers-side and client side capabilities. Bonus points to Sam for demonstrating how nicely JAX-RS 2 asynchronous endpoints and EJB @Asynchronous work together! Sam also shows the Java EE 7 Concurrency Utilities in action and does a nice job explaining the basics/what's going on under the hood.

Thursday Apr 02, 2015

MVC 1.0 (JSR 371) Early Draft Review period has started!

MVC 1.0 (JSR 371) formally known as the 'Model-View-Controller Specification' has just entered the Early Draft Review period. This is significant because it is the first Java EE 8 specification to enter this phase. Kudos to the JSR 371 Expert Group! JSR 371 is ‘just’ a piece of the Java EE 8 story but this step shows that, slowly but surely, Java EE 8 is starting to take shape.

You are strongly encouraged to review the early draft of the specification, test it using Ozark, the open source JSR 371 Reference Implementation and obviously provide comments and feedback!

The MVC specification is really easy to grasp for anybody familiar with JAX-RS, the samples bundled with Ozark will also help to understand the specification. You can also check Ozark's sources and the presentation I gave a few days ago at JavaLand. 

To test the first Ozark milestone build, you need a recent GlassFish build (post 4.1 build, see here for details). Another and simple solution to test JSR 371 and Ozark is to use this script to create a Docker image with GF, Ozark and the JSR 371 samples pre-deployed.

The Early Draft Review period will end of April 30th. For specification related feedback, you can use the JSR 371 users mailing list or the JSR 371 issue tracker. For Ozark related feedback, please use the Ozark users mailing list or the Ozark issue tracker.

So what do you think of JSR 371? Also, should we use this Docker based approach to help you test other upcoming Java EE 8 specifications?

Tuesday Jan 13, 2015

Reactive Jersey Client

One of the common problems of synchronous applications is that they are not using resources in an efficient manner. In a synchronous application, it often happens, for example, that threads are blocked waiting for something to happen.  That is clearly not efficient!  On the other hand, asynchronous applications allows to better utilize those threads but this often comes at a price as it is not that easy to write (complex) asynchronous applications.  Writing asynchronous applications involve having to deal with nested callbacks, the famous "callback hell".  And if the level of nested callbacks is too deep, it can also be very tricky to properly handle errors within the application, etc.

Reactive programming is a popular paradigm used to develop more easily asynchronous applications; it is based around data flows and changes propagations.  This Reactive approach also leads to be more maintainable too as the code is easier to write and understand.

Michal Gajdos of the Jersey Team has just written a series of posts introducing the 'Reactive Jersey Client API', a new generic API allowing end users to utilize the popular reactive programming model when using Jersey Client. 

Tuesday Oct 14, 2014

JSR 339 Maintenance Release: JAX-RS 2.0 rev A

JAX-RS 2.0 (JSR 339) has been slightly revised through the JCP Maintenance Release process and has recently passed the JCP MR ballot

This update (JAX-RS 2.0 rev A) is mostly about clarifications (including JavaDoc clarifications) and some fixes in Jersey, the JAX-RS Reference Implementation. The updated documents will be published soon on the JSR 339 page but in the meantime, you can check this page for details about the changes of JAX-RS 2.0 rev A.

It should be noted that GlassFish 4.1, the Java EE 7 Reference Implementation, already supports this version of the JAX-RS specification (i.e. JAX-RS 2.0 rev A).

Friday Sep 12, 2014

JSR 370: Java API for RESTful Web Services 2.1

A proposal for JAX-RS 2.1 has been recently submitted to the JCP, this news was a bit overshadowed by the Java EE 8 Platform submission announcement but it is also important. It is important as JAX-RS is a significant technology of the the Java EE Platform but JAX-RS is also very relevant outside of the platform. It is not uncommon to see more specific RESTful based applications built upon a standalone JAX-RS implementation. And with the Client API introduced in JAX-RS 2.0, JAX-RS is also getting more and more relevant in the client space.

JAX-RS 2.1 (JSR 370) has now entered the JSR Review Ballot for a 2 weeks period (ends on September 22). The proposed scope of JAX-RS 2.1 currently includes :

  • Adding support for Server-Sent Events
  • Improving integration with CDI
  • Exploring support for non-blocking I/O in providers (filters, interceptors, etc.)
  • Evaluating ways in which declarative security can be supported
  • Providing integration with JSON-B
  • Making JAXB conditional on runtimes where it is available
  • Building upon the hypermedia API introduced in version 2.0
  • Investigating the reactive programming paradigm as a way to improve the JAX-RS asynchronous client API
  • Evaluating any requirements necessary to support the use of JAX-RS resource classes as controllers in the MVC 1.0 JSR

Even tough JAX-RS 2.1 will be a 'minor' release; its current scope is quite large in terms of added features!

And if you are attending JavaOne, here are a few JAX-RS related sessions that you should consider attending :

Monday Dec 16, 2013

Java EE@Pune JUG

Pune JUG organized a meetup at the Symbiosis Institute of Computer Studies and Research (SICRSR) college campus on December 14th. Led by Harshad Oak (Java Champion and organizer of the IndicThreads conference), Pune JUG is the oldest JUG in India and boasts a vibrant developer community. This month's meetup was focused on the Java EE 7 platform and the ecosystem that is building up around it. The meeting was led by Oracle India's own Vijay Nair. Vijay is a good friend and a lead developer with Oracle's FLEXCUBE development group in India. Among many other things like evangelizing Java EE at local Java user groups and conferences, Vijay contributes heavily to the Cargo Tracker Java EE Blue Prints project in his spare time.

 The event saw an attendance of close to around 100 people with a lot of demos/code and high quality interactions with the audience. Vijay presented no less than three sessions at the meetup:

  • JavaEE.Next(): Java EE 7, 8, and Beyond - This is basically our flagship talk at the moment. The talk briefly covers the evolution of the platform, details the changes in Java EE 7 and invites developers to help shape Java EE 8. The materials for the talk is posted here.
  • Android and iOS Development with Java EE 7 - This was a fairly popular technical session at JavaOne San Francisco 2013 led by me, Ryan Cuprak and Bala Muthuvarathan. The session demonstrates how Java EE 7 acts as an excellent platform for building "headless" back-ends for native mobile applications with REST and WebSocket as the client communication protocols. The materials for the talk is posted here. The code is posted on GitHub.
  • Using NoSQL with JPA, EclipseLink and Java EE - This session explores the current state of the NoSQL landscape and how Java EE can be utilized to access NoSQL solutions such as Oracle NoSQL, MongoDB, Cassandra, etc utilizing JPA style facades or plain CDI. The materials for the talk is posted here. The code is posted on GitHub.

Overall, this was a very positive experience with developers giving two thumbs way up to the Java EE 7 platform!

Friday Jun 21, 2013

JAX-RS 2.0, JTA 1.1, JMS 2.0 Replay: Java EE 7 Launch Webinar Technical Breakouts on YouTube

As stated previously (here) (here), the On-Demand Replay of Java EE 7 Launch Webinar is already available. You can watch the entire Strategy and Technical Keynote there, and all other Technical Breakout sessions as well.

We are releasing the next set of Technical Breakout sessions on GlassFishVideos YouTube channel as well. In this series, we are releasing JAX-RS 2.0, JTA 1.1, and JMS 2.0.

Here's the JAX-RS 2.0 session:

Here's the JTA 1.1 session:

Here's the JMS 2.0 session:

Enjoy watching them over the next few days before we release the next set of videos!

And don't forget to download Java EE 7 SDK and try numerous bundled samples.

Friday Jul 06, 2012

Jersey 2 Integrated in GlassFish 4

JAX-RS 2.0 has released Early Draft 3 and Jersey 2 (the implementation of JAX-RS 2.0) released Milestone 5.

Jakub reported that this milestone is now integrated in GlassFish 4 builds. The first integration has basic functionality working and leaves EJB, CDI, and Validation for the coming months.

Jersey 2.0 in GlassFish 4

TOTD #182 explains how to get started with creating a simple Maven-based application, deploying on GlassFish 4, and using the newly introduced Client API to test the REST endpoint.

GlassFish 4 contains Jersey 2 as the JAX-RS implementation. If you want to use Jersey 1.1 functionality, then Martin's blog provide more details on that. All JAX-RS 1.x functionality will be supported using standard APIs anyway. This workaround is only required if Jersey 1.x functionality needs to be accessed.

Here are some pointers to follow

Provide feedback on Jersey 2 to users@jersey.java.net and JAX-RS specification to users@jax-rs-spec.java.net.

Friday Jun 08, 2012

JAX-RS 2.0 Early Draft - Third Edition Available

JAX-RS 2.0 Early Draft Third Edition is now available. This updated draft include new samples explaining the features and clarifications in content-negotiation, discovery of providers, client-side API, filters and entity interceptors and several other sections.


Provide feedback to users@jax-rs-spec.

Jersey 2.0, the Reference Implementation of JAX-RS 2.0, released their fourth milestone a few days ago as well. Several features have already been implemented there. Note, this is an early development preview and several parts of the API and implementation are still evolving.

Feel like trying it out? Simply go to Maven Central (of course none of this is production quality at this point). The latest JAX-RS Javadocs and Jersey 2.0 API docs are good starting points to explore. And provide them feedback at users@jersey.java.net or @gf_jersey.

Thursday Apr 12, 2012

EclipseLink Moxy Provider for JAX-RS and JAX-WS

EclipseLink MOXy is a JAXB provider bundled in GlassFish 3.1.2. In addition to JAXB RI, it provides XPath Based Mapping, better support for JPA entities, native JSON binding and many other features.

Learn more about MOXy and JAXB examples on their wiki.


Blaise blogged about how MOXy can be leveraged to create a JAX-WS service.You just need to provide data-binding attribute in sun-jaxws.xml and then all the XPath-based mapping can be specified on JAXB beans.

MOXy can also be used as JAX-RS JSON provider on server-side and client-side.

How are you using MOXy in your applications ?

Wednesday Mar 28, 2012

Jersey 2.0 Milestone 2 Now Available

Jersey 2.0 milestone 2 is now available. It builds upon the first milestone and adds several new features such as server-side asynchronous processing, server-side content negotiation, improved JAX-RS parameter injection, and several others.


The REST endpoints can be published on Java SE HTTP Server, Grizzly 2 HTTP container, and some basic Servlet-based deployments. It also provides HTTPURLConnection-based client API implementation. Read about these and more about what's new in Marek's detailed post. Of course this is also the future reference implementation for JAX-RS 2.0.

Feel like trying it out? Simply go to Maven Central (of course none of this is production quality at this point). The latest JAX-RS Javadocs and Jersey 2.0 API docs are good starting points to explore. And provide them feedback at users@jersey.java.net.

Thursday Feb 09, 2012

A status on JAX-RS 2.0. Early Draft.

With the Early Draft of JAX-RS 2.0 review period closed for a little while now, here's Arun's walk through the technology's new and improved features.


The Client API seems to be a very popular feature and one that seems pretty stable at this point. Filters and Handlers is another set of new features enabling interception of requests and responses while Hypermedia, a founding principle for REST, is better supported. JAX-RS 2.0 also offers the ability to validation parameters with BeanValidation, introduces asynchronous processing (returning Future objects on the client side) and finally better connection negotiation. Read all about it here.

JAX-RS has become an important component of the Java EE platform and the cloud theme going forward is only making it even more relevant. Check out this earlier post for Marek's (co Spec Lead on JAX-RS 2.0) take on where the JSR stands.

Friday Jan 06, 2012

Tab Sweep - JSON, OSGi, GlassFish+NetBeans experience, JAXB and JodaTime, file uploads & more

Recent Tips and News on Java, Java EE 6, GlassFish & more :

Radio Receiver

JSON to Java with JDK6 (Julien)
What does the future hold for OSGi without leader Peter Kriens? (JAXenter)
JavaCloudGuy: Glassfish (Java EE 6) is now available as option in #cumulogic (Twitter)
JAXB and Joda-Time: Dates and Times (Blaise)
JAX-RS Tip of the Day: Using YUI2 and YUI3 DataTables with Jersey and jQuery (John)
JAX-RS @MatrixParam example (mkyong)
First experiences and getting started with GlassFish 3.1 and NetBeans 7.x – it’s a breeze (Lucas)
Maven's WAR Overlay: What are WAR Overlays? (DZone)
Book Review for "Java EE 6 with GlassFish Application Server" (Rick)
Managing unmanaged beans in CDI (Nicolas)
Using Bean Validation together with ExtVal in JPA and JSF (Edwin)
Java EE 6 using WebLogic 12c and NetBeans (Video) (Arun)
Spark, A micro Web Framework (spark.com)
Multiple File Upload Examples (John Yeary)
Released: NetBeans Platform 7, The Book (Geertjan)
Java 7: Understanding the Phaser (Niklas)
Where's my log file? (Nigel @ Open Messaging)
Sample: Java EE 6 + Wicket + NetBeans + GlassFish + MySQL (Geertjan)
Using Jsp in a Jersey JAX-RS RESTful application (François)
How to change the Glassfish server log level from command line (François)