Example usage for org.springframework.web.servlet.mvc.method.annotation SseEmitter send

List of usage examples for org.springframework.web.servlet.mvc.method.annotation SseEmitter send

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.method.annotation SseEmitter send.

Prototype

public void send(SseEventBuilder builder) throws IOException 

Source Link

Document

Send an SSE event prepared with the given builder.

Usage

From source file:com.bodybuilding.argos.controller.SseEmitterUtil.java

private static <T> void internalEmit(SseEmitter emitter, T data, MediaType mediaType) {
    try {//from  w  w  w. j a v  a  2 s .co m
        if (mediaType == null) {
            emitter.send(data);
        } else {
            emitter.send(data, mediaType);
        }
    } catch (ClientAbortException ignored) {
    } catch (IllegalStateException e) {
        if (!e.getMessage().contains("ResponseBodyEmitter is already set complete")) {
            throw e;
        }
    } catch (Throwable e) {
        throw Throwables.propagate(e);
    }
}