<commit_before>package org.reactor.transport.websockets;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.reactor.response.ReactorResponse;
import org.reactor.transport.ReactorMessageTransport;
import org.reactor.transport.ReactorMessageTransportInitializationException;
import org.reactor.transport.ReactorMessageTransportProcessor;
import org.reactor.transport.TransportProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WebSocketsMessageTransport implements ReactorMessageTransport {

    private final static Logger LOG = LoggerFactory.getLogger(WebSocketsMessageTransport.class);

    public static final String STATIC_DIR = "static";
    //public static final String STATIC_DIR = "/opt/java/projects/reactor/reactor-transport-websockets-jetty/src/main/resources/static";

    private Server server;
    private ReactorWebsocketHandler webSocketHandler;

    @Override
    public void startTransport(TransportProperties transportProperties, ReactorMessageTransportProcessor messageProcessor) {
        startWebSocketsTransport(new WebSocketsTransportProperties(transportProperties), messageProcessor);
    }

    private void startWebSocketsTransport(WebSocketsTransportProperties transportProperties,
                                          ReactorMessageTransportProcessor messageProcessor) {
        try {
            server = new Server(transportProperties.getPortNumber());
            server.setHandler(createWebSocketsHandler(messageProcessor));
            server.start();
        } catch (Exception e) {
            throw new ReactorMessageTransportInitializationException(e);
        }
    }

    private ReactorWebsocketHandler createWebSocketsHandler(ReactorMessageTransportProcessor messageProcessor) {
        webSocketHandler = new ReactorWebsocketHandler(messageProcessor);
        webSocketHandler.setHandler(createResourceHandler());
        return webSocketHandler;
    }

    private ResourceHandler createResourceHandler() {
        ResourceHandler resourceHandler = new ResourceHandler();
        //resourceHandler.setBaseResource(Resource.newClassPathResource(STATIC_DIR));
        resourceHandler.setResourceBase(STATIC_DIR);
        return resourceHandler;<commit_msg>Fixed websocket transport static files location<commit_after>package org.reactor.transport.websockets;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.resource.Resource;
import org.reactor.response.ReactorResponse;
import org.reactor.transport.ReactorMessageTransport;
import org.reactor.transport.ReactorMessageTransportInitializationException;
import org.reactor.transport.ReactorMessageTransportProcessor;
import org.reactor.transport.TransportProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WebSocketsMessageTransport implements ReactorMessageTransport {

    private final static Logger LOG = LoggerFactory.getLogger(WebSocketsMessageTransport.class);

    public static final String STATIC_DIR = "static";

    private Server server;
    private ReactorWebsocketHandler webSocketHandler;

    @Override
    public void startTransport(TransportProperties transportProperties, ReactorMessageTransportProcessor messageProcessor) {
        startWebSocketsTransport(new WebSocketsTransportProperties(transportProperties), messageProcessor);
    }

    private void startWebSocketsTransport(WebSocketsTransportProperties transportProperties,
                                          ReactorMessageTransportProcessor messageProcessor) {
        try {
            server = new Server(transportProperties.getPortNumber());
            server.setHandler(createWebSocketsHandler(messageProcessor));
            server.start();
        } catch (Exception e) {
            throw new ReactorMessageTransportInitializationException(e);
        }
    }

    private ReactorWebsocketHandler createWebSocketsHandler(ReactorMessageTransportProcessor messageProcessor) {
        webSocketHandler = new ReactorWebsocketHandler(messageProcessor);
        webSocketHandler.setHandler(createResourceHandler());
        return webSocketHandler;
    }

    private ResourceHandler createResourceHandler() {
        ResourceHandler resourceHandler = new ResourceHandler();
        resourceHandler.setBaseResource(Resource.newClassPathResource(STATIC_DIR));
        return resourceHandler;
{'fraction_non_alphanumeric': 0.06480446927374302, 'fraction_numerical': 0.000893854748603352, 'mean_word_length': 4.623115577889447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3757187', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1015, 'n_words': 195}