Top Description Constructors Methods
org.springframework.web.socket.sockjs.transport.handler

public Class DefaultSockJsService

extends TransportHandlingSockJsService
implements ServletContextAware
Class Inheritance
All Implemented Interfaces
org.springframework.web.context.ServletContextAware, org.springframework.beans.factory.Aware
Imports
java.util.Arrays, .Collection, .LinkedHashSet, .Set, jakarta.servlet.ServletContext, org.apache.commons.logging.Log, .LogFactory, org.springframework.lang.Nullable, org.springframework.scheduling.TaskScheduler, org.springframework.web.context.ServletContextAware, org.springframework.web.socket.server.support.DefaultHandshakeHandler, org.springframework.web.socket.sockjs.transport.TransportHandler, .TransportHandlingSockJsService

A default implementation of org.springframework.web.socket.sockjs.SockJsService with all default TransportHandler implementations pre-registered.
Authors
Rossen Stoyanchev, Juergen Hoeller
Since
4.0

Constructor Summary

AccessConstructor and Description
public
DefaultSockJsService(TaskScheduler
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 is initialized at start up and shut down when the application stops.
scheduler
)

Create a DefaultSockJsService with default handler types.

public
DefaultSockJsService(TaskScheduler
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
scheduler
,
TransportHandler...
zero or more overrides to the default transport handler types
handlerOverrides
)

Create a DefaultSockJsService with overridden handler types replacing the corresponding default handler implementation.

public
DefaultSockJsService(TaskScheduler
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
scheduler
,
Collection<TransportHandler>
zero or more overrides to the default transport handler types
handlerOverrides
)

Create a DefaultSockJsService with overridden handler types replacing the corresponding default handler implementation.

Method Summary

Modifier and TypeMethod and Description
private static Set<TransportHandler>
public void
setServletContext(ServletContext
the ServletContext object to be used by this object
servletContext
)

Implements org.springframework.web.context.ServletContextAware.setServletContext.

Set the ServletContext that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method.

Inherited from org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService:
getHandshakeInterceptorsgetMessageCodecgetTransportHandlershandleRawWebSocketRequesthandleTransportRequestisRunningsetHandshakeInterceptorssetMessageCodecstartstopvalidateRequest

Constructor Detail

DefaultSockJsServiceback to summary
public DefaultSockJsService(TaskScheduler scheduler)

Create a DefaultSockJsService with default handler types.

Parameters
scheduler:TaskScheduler

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 is initialized at start up and shut down when the application stops.

DefaultSockJsServiceback to summary
public DefaultSockJsService(TaskScheduler scheduler, TransportHandler... handlerOverrides)

Create a DefaultSockJsService with overridden handler types replacing the corresponding default handler implementation.

Parameters
scheduler:TaskScheduler

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

handlerOverrides:TransportHandler[]

zero or more overrides to the default transport handler types

DefaultSockJsServiceback to summary
public DefaultSockJsService(TaskScheduler scheduler, Collection<TransportHandler> handlerOverrides)

Create a DefaultSockJsService with overridden handler types replacing the corresponding default handler implementation.

Parameters
scheduler:TaskScheduler

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

handlerOverrides:Collection<TransportHandler>

zero or more overrides to the default transport handler types

Method Detail

getDefaultTransportHandlersback to summary
private static Set<TransportHandler> getDefaultTransportHandlers(Collection<TransportHandler> overrides)
setServletContextback to summary
public void setServletContext(ServletContext servletContext)

Implements org.springframework.web.context.ServletContextAware.setServletContext.

Doc from org.springframework.web.context.ServletContextAware.setServletContext.

Set the ServletContext that this object runs in.

Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext.

Parameters
servletContext:ServletContext

the ServletContext object to be used by this object

Annotations
@Override