Class UndertowSession

  • All Implemented Interfaces:
    jakarta.websocket.Session, java.io.Closeable, java.lang.AutoCloseable

    public final class UndertowSession
    extends java.lang.Object
    implements jakarta.websocket.Session
    Session implementation which makes use of the high-level WebSocket API of undertow under the hood.
    Author:
    Norman Maurer
    • Method Detail

      • getContainer

        public ServerWebSocketContainer getContainer()
        Specified by:
        getContainer in interface jakarta.websocket.Session
      • addMessageHandler

        public void addMessageHandler​(jakarta.websocket.MessageHandler messageHandler)
                               throws java.lang.IllegalStateException
        Specified by:
        addMessageHandler in interface jakarta.websocket.Session
        Throws:
        java.lang.IllegalStateException
      • addMessageHandler

        public <T> void addMessageHandler​(java.lang.Class<T> clazz,
                                          jakarta.websocket.MessageHandler.Whole<T> handler)
        Specified by:
        addMessageHandler in interface jakarta.websocket.Session
      • addMessageHandler

        public <T> void addMessageHandler​(java.lang.Class<T> clazz,
                                          jakarta.websocket.MessageHandler.Partial<T> handler)
        Specified by:
        addMessageHandler in interface jakarta.websocket.Session
      • getMessageHandlers

        public java.util.Set<jakarta.websocket.MessageHandler> getMessageHandlers()
        Specified by:
        getMessageHandlers in interface jakarta.websocket.Session
      • removeMessageHandler

        public void removeMessageHandler​(jakarta.websocket.MessageHandler messageHandler)
        Specified by:
        removeMessageHandler in interface jakarta.websocket.Session
      • setReceiveListener

        public void setReceiveListener​(org.xnio.ChannelListener<io.undertow.websockets.core.WebSocketChannel> handler)
        sets the recieve listener This should only be used for annotated endpoints.
        Parameters:
        handler - The handler
      • getProtocolVersion

        public java.lang.String getProtocolVersion()
        Specified by:
        getProtocolVersion in interface jakarta.websocket.Session
      • getNegotiatedSubprotocol

        public java.lang.String getNegotiatedSubprotocol()
        Specified by:
        getNegotiatedSubprotocol in interface jakarta.websocket.Session
      • isSecure

        public boolean isSecure()
        Specified by:
        isSecure in interface jakarta.websocket.Session
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface jakarta.websocket.Session
      • getMaxIdleTimeout

        public long getMaxIdleTimeout()
        Specified by:
        getMaxIdleTimeout in interface jakarta.websocket.Session
      • setMaxIdleTimeout

        public void setMaxIdleTimeout​(long milliseconds)
        Specified by:
        setMaxIdleTimeout in interface jakarta.websocket.Session
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface jakarta.websocket.Session
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface jakarta.websocket.Session
        Throws:
        java.io.IOException
      • close

        public void close​(jakarta.websocket.CloseReason closeReason)
                   throws java.io.IOException
        Specified by:
        close in interface jakarta.websocket.Session
        Throws:
        java.io.IOException
      • closeInternal

        public void closeInternal()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • closeInternal

        public void closeInternal​(jakarta.websocket.CloseReason closeReason)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • forceClose

        public void forceClose()
      • getRequestURI

        public java.net.URI getRequestURI()
        Specified by:
        getRequestURI in interface jakarta.websocket.Session
      • getRequestParameterMap

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getRequestParameterMap()
        Specified by:
        getRequestParameterMap in interface jakarta.websocket.Session
      • getQueryString

        public java.lang.String getQueryString()
        Specified by:
        getQueryString in interface jakarta.websocket.Session
      • getPathParameters

        public java.util.Map<java.lang.String,​java.lang.String> getPathParameters()
        Specified by:
        getPathParameters in interface jakarta.websocket.Session
      • getUserProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getUserProperties()
        Specified by:
        getUserProperties in interface jakarta.websocket.Session
      • getUserPrincipal

        public java.security.Principal getUserPrincipal()
        Specified by:
        getUserPrincipal in interface jakarta.websocket.Session
      • setMaxBinaryMessageBufferSize

        public void setMaxBinaryMessageBufferSize​(int i)
        Specified by:
        setMaxBinaryMessageBufferSize in interface jakarta.websocket.Session
      • getMaxBinaryMessageBufferSize

        public int getMaxBinaryMessageBufferSize()
        Specified by:
        getMaxBinaryMessageBufferSize in interface jakarta.websocket.Session
      • setMaxTextMessageBufferSize

        public void setMaxTextMessageBufferSize​(int i)
        Specified by:
        setMaxTextMessageBufferSize in interface jakarta.websocket.Session
      • getMaxTextMessageBufferSize

        public int getMaxTextMessageBufferSize()
        Specified by:
        getMaxTextMessageBufferSize in interface jakarta.websocket.Session
      • getAsyncRemote

        public jakarta.websocket.RemoteEndpoint.Async getAsyncRemote()
        Specified by:
        getAsyncRemote in interface jakarta.websocket.Session
      • getBasicRemote

        public jakarta.websocket.RemoteEndpoint.Basic getBasicRemote()
        Specified by:
        getBasicRemote in interface jakarta.websocket.Session
      • getOpenSessions

        public java.util.Set<jakarta.websocket.Session> getOpenSessions()
        Specified by:
        getOpenSessions in interface jakarta.websocket.Session
      • getNegotiatedExtensions

        public java.util.List<jakarta.websocket.Extension> getNegotiatedExtensions()
        Specified by:
        getNegotiatedExtensions in interface jakarta.websocket.Session
      • getEncoding

        public Encoding getEncoding()
      • getWebSocketChannel

        public io.undertow.websockets.core.WebSocketChannel getWebSocketChannel()
      • getExecutor

        public java.util.concurrent.Executor getExecutor()