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

net.openhft.chronicle.websocket.jetty.JettyServletFactory Maven / Gradle / Ivy

package net.openhft.chronicle.websocket.jetty;

import net.openhft.chronicle.wire.MarshallableOut;
import net.openhft.chronicle.wire.WireIn;
import org.eclipse.jetty.websocket.servlet.*;

import java.util.function.BiConsumer;
import java.util.function.Function;

public class JettyServletFactory extends WebSocketServlet implements WebSocketCreator {
    private final Function outWrapper;
    private final BiConsumer channel;

    public JettyServletFactory(Function outWrapper, BiConsumer channel) {
        this.outWrapper = outWrapper;
        this.channel = channel;
    }

    @Override
    public void configure(WebSocketServletFactory factory) {
        factory.setCreator(this);
    }

    @Override
    public Object createWebSocket(ServletUpgradeRequest servletUpgradeRequest, ServletUpgradeResponse servletUpgradeResponse) {
        return new JettyWebSocketAdapter(outWrapper, channel);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy