Building server-side events with JAX-RS
Usually, web applications rely on the events sent by the client side. So, basically the server will only do something if it is asked to.
But with the evolution of the technologies surrounding the internet (HTML5, mobile clients, smartphones, and so on), the server side also had to evolve. So that gave birth to the server-side events, events fired by the server (as the name suggests).
With this recipe, you will learn how to use the server-side event to update a user view.
Getting ready
Start by adding the Java EE dependency:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
How to do it...
First, we build a REST endpoint to manage the server events we are going to use, and to use REST we should start...