Java Code Examples for javax.ws.rs.sse.InboundSseEvent#readData()

The following examples show how to use javax.ws.rs.sse.InboundSseEvent#readData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SseTypeSafeProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public void onNext(InboundSseEvent t) {
    LOG.entering(SseTypeSafeProcessor.class.getName(), "onNext", t);
    if (incomingSubscription == null) {
        throw new IllegalStateException("not subscribed");
    }
    if (!isClosed.get()) {
        @SuppressWarnings("unchecked")
        T data = (T) t.readData(type);
        for (Subscriber<? super T> subscriber : subscribers) {
            subscriber.onNext(data);
        }
    }
    LOG.exiting(SseTypeSafeProcessor.class.getName(), "onNext");
}
 
Example 2
Source File: RestSBServerSentEvent.java    From onos with Apache License 2.0 5 votes vote down vote up
public RestSBServerSentEvent(Type type, DeviceId deviceId, InboundSseEvent sseEvent) {
    super(type, deviceId);
    checkNotNull(sseEvent);
    data = sseEvent.readData();
    id = sseEvent.getId();
    name = sseEvent.getName();
    comment = sseEvent.getComment();
}
 
Example 3
Source File: StatsClient.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static void print(InboundSseEvent event) {
    final Stats stats = event.readData(Stats.class, MediaType.APPLICATION_JSON_TYPE);
    System.out.println(stats.getTimestamp() + ": " + stats.getLoad() + "%");
}
 
Example 4
Source File: JerseyClientHeaders.java    From tutorials with MIT License 4 votes vote down vote up
private static void receiveEvent(InboundSseEvent event) {
    sseHeaderValue = event.readData();
}