Building the request handling layer
The web request handling layer for Ext JS 4 clients is a JSON-generating proxy to the service layer interfaces. The domain entities are converted into JSON representations within this layer; so our first step is to create some helper code to make this task easier.
There are several excellent open source JSON generation projects that can assist in this task including Jackson (http://jackson.codehaus.org) and Google Gson (http://code.google.com/p/google-gson/). Such libraries parse POJOs into an appropriate JSON representation via their declared fields. With the release of Java EE 7, we no longer have a need for third-party libraries. The Java API for JSON Processing (JSR-353) is available in all Java EE 7-compliant application servers including GlassFish 4. We will leverage this API for generating and parsing JSON data.
Note
If you are unable to use a Java EE 7 application server, you will need to select an alternate JSON-generating strategy, such as Jackson...