Posts tagged glassfish
In this article, I show how I have created a simple and fairly meaningless Java EE 7 application that uses a number of smart Java EE features:
- a stateless session bean has a scheduled method (that is triggered every 3 seconds)
- the stateless session bean publishes custom CDI events
- a class annotated as WebSocket EndPoint manages WebSocket channels with WS clients (in this case simple HTML browser applications) – echoing messages between the clients
- the WebSocket Endpoint also observes the CDI event and pushes the event payload to each of the WebSocket clients
Using NetBeans 7.3.1 and GlassFish 4.0 – as well as a number of blog-articles and sample applications – this turned out to be very simple to put together.
This next figure visualizes what I did:
The important steps to come to a running applications are:
- create new Java EE 7 project in NetBeans
- create class TimeEvent that will be used to publish as CDI event
- create class EventProducer – a stateless EJB session bean that is scheduled to trigger every 3 seconds; it publishes a TimeEvent whenever it is triggered
- create class SocketMediator – an annotated POJO that has the ServerEndpoint annotation (to More >
Last week saw the release of Java EE 7 – the new edition of the Java Enterprise platform. It is a substantial release – which advances the Java Enterprise Platform in many areas. What this release consists of really is the following
- the common understanding between major stakeholders in the Java community – laid down in formal specifications – about how the Java platform will support many aspects of implementing enterprise applications, including (fairly) recent developments such as RESTful services, JSON format, WebSockets communication, HTML 5 rendering, parallel batch processing.
- an example implementation of a Java EE container that will run Java EE applications that are built according to said specifications; this is GlassFish 4.0 Application Server.
- an important incentive to Java vendors to upgrade their Java EE containers (JBoss, Tomcat, IBM, Oracle, …) and a similar impetus for Java developers to upgrade their skill set and start leveraging new standards and facilities (although at this point most of us are still absorbing many of the Java EE 6 improvements)
- a fresh wave of energy, focus, enthusiasm, hope and expectation through the Java community; Java is alive and More >
According to the PrimeFaces website, “PrimeFaces is an open source component suite for Java Server Faces featuring 70+ Ajax powered rich set of JSF components. Additional TouchFaces module features a UI kit for developing mobile web applications.“. Since it is an OpenSource JSF implementation that is very close to releasing JSF 2.0 compliant components, I figured it was time to try it out on GlassFish v3. (more…)