org.springframework.web.socket.adapter.jetty

Class JettyWebSocketSession

    • Constructor Detail

      • JettyWebSocketSession

        public JettyWebSocketSession(java.util.Map<java.lang.String,java.lang.Object> attributes)
        Create a new JettyWebSocketSession instance.
        Parameters:
        attributes - attributes from the HTTP handshake to associate with the WebSocket session
      • JettyWebSocketSession

        public JettyWebSocketSession(java.util.Map<java.lang.String,java.lang.Object> attributes,
                                     @Nullable
                                     java.security.Principal user)
        Create a new JettyWebSocketSession instance associated with the given user.
        Parameters:
        attributes - attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.
        user - the user associated with the session; if null we'll fallback on the user available via Session.getUpgradeRequest()
    • Method Detail

      • getId

        public java.lang.String getId()
        Description copied from interface: WebSocketSession
        Return a unique session identifier.
      • getUri

        @Nullable
        public java.net.URI getUri()
        Description copied from interface: WebSocketSession
        Return the URI used to open the WebSocket connection.
      • getHandshakeHeaders

        public HttpHeaders getHandshakeHeaders()
        Description copied from interface: WebSocketSession
        Return the headers used in the handshake request (never null).
      • getAcceptedProtocol

        public java.lang.String getAcceptedProtocol()
        Description copied from interface: WebSocketSession
        Return the negotiated sub-protocol.
        Returns:
        the protocol identifier, or null if no protocol was specified or negotiated successfully
      • getExtensions

        public java.util.List<WebSocketExtension> getExtensions()
        Description copied from interface: WebSocketSession
        Determine the negotiated extensions.
        Returns:
        the list of extensions, or an empty list if no extension was specified or negotiated successfully
      • getPrincipal

        public java.security.Principal getPrincipal()
        Description copied from interface: WebSocketSession
        Return a Principal instance containing the name of the authenticated user.

        If the user has not been authenticated, the method returns null.

      • getLocalAddress

        public java.net.InetSocketAddress getLocalAddress()
        Description copied from interface: WebSocketSession
        Return the address on which the request was received.
      • getRemoteAddress

        public java.net.InetSocketAddress getRemoteAddress()
        Description copied from interface: WebSocketSession
        Return the address of the remote client.
      • setTextMessageSizeLimit

        public void setTextMessageSizeLimit(int messageSizeLimit)
        Description copied from interface: WebSocketSession
        Configure the maximum size for an incoming text message.
      • getTextMessageSizeLimit

        public int getTextMessageSizeLimit()
        Description copied from interface: WebSocketSession
        Get the configured maximum size for an incoming text message.
      • setBinaryMessageSizeLimit

        public void setBinaryMessageSizeLimit(int messageSizeLimit)
        Description copied from interface: WebSocketSession
        Configure the maximum size for an incoming binary message.
      • getBinaryMessageSizeLimit

        public int getBinaryMessageSizeLimit()
        Description copied from interface: WebSocketSession
        Get the configured maximum size for an incoming binary message.
      • isOpen

        public boolean isOpen()
        Description copied from interface: WebSocketSession
        Return whether the connection is still open.