The write-up for the JavaOne 2014 session on Apache Cordova and Java EE 7 doesn’t quite do it justice. The presentation covers the interaction between the EE 7 and Cordova. For those that aren’t aware, Cordova (aka PhoneGap) is a dev environment that enables you to write rich apps for iOS/Android/Windows Phone/BlackBerry/Tizen using JavaScript and HTML5. This is MUCH easier than writing a native app. Most users probably couldn’t tell the difference between a Cordova app and a native app. In fact, most people probably have several HTML5 apps installed and aren’t aware of it. A Cordova app, through JavaScript APIs, gets access to device features such as the compass, camera, video record, GPS (above what’s in HTML5), Contacts, vibrate functionality, etc.
For the presentation I have written a large Apache Cordova application, called N34Sailor. This is an application for organizing a sailing race. It enables a committee boat to select a course, handles registration of sailboats in the course, and finally enables the committee boat to send out updates and track the progress of the race. The N34Sailor application is a Single Page Application (SPA). The UI was created using JQuery Mobile (initially tried Sencha Touch but decided that would have been a 2 hour presentation itself). The content is not served up from the container – it runs locally!
In addition to the basics, this presentation will cover:
- Token based authentication – username/password ARE NOT cached in the application. This is implemented using JASPIC!
- GZIP compressing of JSON using JAX-RS 2.0
- Mixing WebSocket endpoints with Stateful Session Beans and the extended Persistence context.
- Taking pictures and uploading them using JAX-RS 2.0.
- IndexDB and LocalStorage for offline support.
- Testing using:
- Arquillian and the client-side JAX-RS 2.0 and WebSocket APIs
- Karma/Jasmine testing – specifically of RESTful calls.
- Deployment to Android and iOS.
- Deployment to the cloud – app needs to be load balanced!
- Initial development using Chrome and how to use JAX-RS to deal with CORS issues.
I am probably forgetting things. Currently the slide deck stands at 128+ slides (some cool animations!).
BTW: I still have QA to do but this app will be making it to the App Store!