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

com.ithit.webdav.integration.servlet.websocket.DavServerApplicationConfig Maven / Gradle / Ivy

There is a newer version: 7.3.10641
Show newest version
package com.ithit.webdav.integration.servlet.websocket;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import jakarta.websocket.Endpoint;
import jakarta.websocket.server.ServerApplicationConfig;
import jakarta.websocket.server.ServerEndpointConfig;
import jakarta.websocket.server.ServerEndpointConfig.Builder;

/**
 * Configures WebSocket endpoints for DAV servlet.
 */
public class DavServerApplicationConfig implements ServerApplicationConfig {

    /**
     * Returns context where DAV WebSocket will be available;
     * @return web socket context path.
     */
    protected String getWebSocketPath() {
        return "/";
    }

    @Override
    public Set getEndpointConfigs(Set> endpointClasses) {
        Set result = new HashSet<>();
        for (Class epClass : endpointClasses) {
            if (DavWebSocketEndpoint.class.isAssignableFrom(epClass)) {
                ServerEndpointConfig sec = Builder
                        .create(epClass, getWebSocketPath())
                        .configurator(new DavHttpSessionConfigurator())
                        .encoders(Collections.singletonList(DavWebSocketNotificationEncoder.class))
                        .build();
                result.add(sec);
            }
        }
        return result;
    }

    @Override
    public Set> getAnnotatedEndpointClasses(Set> set) {
        return set;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy