All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jobrunr.dashboard.sse.AbstractObjectSseExchange Maven / Gradle / Ivy

package org.jobrunr.dashboard.sse;

import com.sun.net.httpserver.HttpExchange;
import org.jobrunr.dashboard.server.sse.SseExchange;
import org.jobrunr.utils.mapper.JsonMapper;

import java.io.IOException;

public class AbstractObjectSseExchange extends SseExchange {

    private final JsonMapper jsonMapper;

    public AbstractObjectSseExchange(HttpExchange httpExchange, JsonMapper jsonMapper) throws IOException {
        super(httpExchange);
        this.jsonMapper = jsonMapper;
    }

    public String sendObject(Object object) {
        final String message = jsonMapper.serialize(object);
        sendMessage(message);
        return message;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy