Example usage for org.springframework.web.socket.sockjs.transport TransportHandler getTransportType

List of usage examples for org.springframework.web.socket.sockjs.transport TransportHandler getTransportType

Introduction

In this page you can find the example usage for org.springframework.web.socket.sockjs.transport TransportHandler getTransportType.

Prototype

TransportType getTransportType();

Source Link

Document

Return the transport type supported by this handler.

Usage

From source file:org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.java

/**
 * Create a TransportHandlingSockJsService with given {@link TransportHandler handler} types.
 * @param scheduler a task scheduler for heart-beat messages and removing timed-out sessions;
 * the provided TaskScheduler should be declared as a Spring bean to ensure it gets
 * initialized at start-up and shuts down when the application stops
 * @param handlers one or more {@link TransportHandler} implementations to use
 *///w  ww . ja  v a2s.  c  om
public TransportHandlingSockJsService(TaskScheduler scheduler, Collection<TransportHandler> handlers) {
    super(scheduler);

    if (CollectionUtils.isEmpty(handlers)) {
        logger.warn("No transport handlers specified for TransportHandlingSockJsService");
    } else {
        for (TransportHandler handler : handlers) {
            handler.initialize(this);
            this.handlers.put(handler.getTransportType(), handler);
        }
    }

    if (jackson2Present) {
        this.messageCodec = new Jackson2SockJsMessageCodec();
    }
}