From the course: Java EE 8 Essential Training

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Server-Sent Events

Server-Sent Events - Java EE Tutorial

From the course: Java EE 8 Essential Training

Start my 1-month free trial

Server-Sent Events

- [Instructor] One of the feature found within Java EE 8 is the support for server sent events within JAX-RS. Server sent events allow us to establish a one-way channel from a server to a client which can be reused to send multiple events. Let's take a look at how to use server sent events within our application. So, to get started, I'm going to open the "New" dialog and I'm going to create a resource. So, we'll advance to the next pane here and we'll provide a name for the resource. It's going to be the sseinventoryitemendpoint and then we can supply a path, which is going to be /sse/inventoryitems and then we're only going to support Jason, so I'm going to remove XML media type. And then we'll hit next and we can skip the creation of a JAX-RS application because we already have one. The first thing we'll do in this resource is change its scope to a singleton so there's going to be one instance for our entire…

Contents