Class SubProtocolHandlerRegistry

java.lang.Object
org.springframework.integration.websocket.support.SubProtocolHandlerRegistry

public final class SubProtocolHandlerRegistry
extends java.lang.Object
The utility class to encapsulate search algorithms for a set of provided SubProtocolHandlers.

For internal use only.

Since:
4.1
See Also:
WebSocketInboundChannelAdapter, WebSocketOutboundMessageHandler
  • Constructor Summary

    Constructors 
    Constructor Description
    SubProtocolHandlerRegistry​(java.util.List<org.springframework.web.socket.messaging.SubProtocolHandler> protocolHandlers)  
    SubProtocolHandlerRegistry​(java.util.List<org.springframework.web.socket.messaging.SubProtocolHandler> protocolHandlers, org.springframework.web.socket.messaging.SubProtocolHandler defaultProtocolHandler)  
    SubProtocolHandlerRegistry​(org.springframework.web.socket.messaging.SubProtocolHandler defaultProtocolHandler)  
  • Method Summary

    Modifier and Type Method Description
    org.springframework.web.socket.messaging.SubProtocolHandler findProtocolHandler​(org.springframework.web.socket.WebSocketSession session)
    Resolves the SubProtocolHandler for the given session using its accepted sub-protocol.
    java.util.List<java.lang.String> getSubProtocols()
    Return the List of sub-protocols from provided SubProtocolHandler.
    java.lang.String resolveSessionId​(org.springframework.messaging.Message<?> message)
    Resolves the sessionId for the given message using the SubProtocolHandler.resolveSessionId(org.springframework.messaging.Message<?>) algorithm.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SubProtocolHandlerRegistry

      public SubProtocolHandlerRegistry​(java.util.List<org.springframework.web.socket.messaging.SubProtocolHandler> protocolHandlers)
    • SubProtocolHandlerRegistry

      public SubProtocolHandlerRegistry​(org.springframework.web.socket.messaging.SubProtocolHandler defaultProtocolHandler)
    • SubProtocolHandlerRegistry

      public SubProtocolHandlerRegistry​(java.util.List<org.springframework.web.socket.messaging.SubProtocolHandler> protocolHandlers, org.springframework.web.socket.messaging.SubProtocolHandler defaultProtocolHandler)
  • Method Details

    • findProtocolHandler

      public org.springframework.web.socket.messaging.SubProtocolHandler findProtocolHandler​(org.springframework.web.socket.WebSocketSession session)
      Resolves the SubProtocolHandler for the given session using its accepted sub-protocol.
      Parameters:
      session - The session to resolve the sub-protocol handler for
      Returns:
      The sub-protocol handler
      Throws:
      java.lang.IllegalStateException - if a protocol handler cannot be resolved
    • resolveSessionId

      public java.lang.String resolveSessionId​(org.springframework.messaging.Message<?> message)
      Resolves the sessionId for the given message using the SubProtocolHandler.resolveSessionId(org.springframework.messaging.Message<?>) algorithm.
      Parameters:
      message - The message to resolve the sessionId from.
      Returns:
      The sessionId or null, if no one SubProtocolHandler can't resolve it against provided message.
    • getSubProtocols

      public java.util.List<java.lang.String> getSubProtocols()
      Return the List of sub-protocols from provided SubProtocolHandler.
      Returns:
      The the List of supported sub-protocols.