use of org.glassfish.jersey.media.sse.EventOutput in project jersey by jersey.
the class FlightSimResource method connect.
@GET
@Path("events")
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput connect() {
EventOutput output = new EventOutput();
SimEngine.register(output);
return output;
}
use of org.glassfish.jersey.media.sse.EventOutput in project jersey by jersey.
the class MessageStreamResource method getMessageStream.
/**
* Get the new SSE message stream channel.
*
* @return new SSE message stream channel.
*/
@GET
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput getMessageStream() {
LOGGER.info("--> SSE connection received.");
final EventOutput eventOutput = new EventOutput();
broadcaster.add(eventOutput);
return eventOutput;
}
use of org.glassfish.jersey.media.sse.EventOutput in project javaee7-samples by javaee-samples.
the class MyResource method itemEvents.
@GET
@Path("events")
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput itemEvents() {
final EventOutput eventOutput = new EventOutput();
BROADCASTER.add(eventOutput);
return eventOutput;
}
use of org.glassfish.jersey.media.sse.EventOutput in project jersey by jersey.
the class DomainResource method getProgress.
@Path("process/{id}")
@Produces(SseFeature.SERVER_SENT_EVENTS)
@GET
public EventOutput getProgress(@PathParam("id") int id, @DefaultValue("false") @QueryParam("testSource") boolean testSource) {
final Process process = processes.get(id);
if (process != null) {
if (testSource) {
process.release();
}
final EventOutput eventOutput = new EventOutput();
process.getBroadcaster().add(eventOutput);
return eventOutput;
} else {
throw new NotFoundException();
}
}
use of org.glassfish.jersey.media.sse.EventOutput in project jersey by jersey.
the class ServerSentEventsResource method close.
@DELETE
public void close() throws IOException {
eventOutput.close();
ServerSentEventsResource.setEventOutput(new EventOutput());
}
Aggregations