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

public Interface TransportHandler

Known Direct Implementers
org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
Imports
org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.sockjs.SockJsException, .SockJsService

Handle a SockJS session URL, i.e. transport-specific request.
Authors
Rossen Stoyanchev, Juergen Hoeller
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the session matches (and would therefore get accepted by handleRequest), or false otherwise
checkSessionType
(SockJsSession session)

Check whether the type of the given session matches the transport type of this TransportHandler where session id and the transport type are extracted from the SockJS URL.

public TransportType
getTransportType()

Return the transport type supported by this handler.

public void
handleRequest(ServerHttpRequest
the current request
request
,
ServerHttpResponse
the current response
response
,
WebSocketHandler
the target WebSocketHandler (never null)
handler
,
SockJsSession
the SockJS session (never null)
session
)

Handle the given request and delegate messages to the provided WebSocketHandler.

public void
initialize(SockJsServiceConfig
the configuration as defined by the containing org.springframework.web.socket.sockjs.SockJsService
serviceConfig
)

Initialize this handler with the given configuration.

Method Detail

checkSessionTypeback to summary
public boolean checkSessionType(SockJsSession session)

Check whether the type of the given session matches the transport type of this TransportHandler where session id and the transport type are extracted from the SockJS URL.

Returns:boolean

true if the session matches (and would therefore get accepted by handleRequest), or false otherwise

Since
4.3.4
getTransportTypeback to summary
public TransportType getTransportType()

Return the transport type supported by this handler.

handleRequestback to summary
public void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler handler, SockJsSession session) throws SockJsException

Handle the given request and delegate messages to the provided WebSocketHandler.

Parameters
request:ServerHttpRequest

the current request

response:ServerHttpResponse

the current response

handler:WebSocketHandler

the target WebSocketHandler (never null)

session:SockJsSession

the SockJS session (never null)

Exceptions
SockJsException:
raised when request processing fails as explained in SockJsService
initializeback to summary
public void initialize(SockJsServiceConfig serviceConfig)

Initialize this handler with the given configuration.

Parameters
serviceConfig:SockJsServiceConfig

the configuration as defined by the containing org.springframework.web.socket.sockjs.SockJsService