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

org.webbitserver.handler.logging.LoggingEventSourceConnection Maven / Gradle / Ivy

There is a newer version: 0.4.15
Show newest version
package org.webbitserver.handler.logging;

import org.webbitserver.EventSourceConnection;
import org.webbitserver.netty.contrib.EventSourceMessage;
import org.webbitserver.wrapper.EventSourceConnectionWrapper;

class LoggingEventSourceConnection extends EventSourceConnectionWrapper {

    private final LogSink logSink;

    LoggingEventSourceConnection(LogSink logSink, EventSourceConnection connection) {
        super(connection);
        this.logSink = logSink;
    }

    @Override
    public EventSourceConnectionWrapper send(String message) {
        logSink.eventSourceOutboundData(this, message);
        return super.send(message);
    }

    @Override
    public EventSourceConnectionWrapper send(EventSourceMessage message) {
        logSink.eventSourceOutboundData(this, message.build() + "\n");
        return super.send(message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy