Package io.undertow.websockets.jsr
Class UndertowSession
- java.lang.Object
-
- io.undertow.websockets.jsr.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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessageHandler(jakarta.websocket.MessageHandler messageHandler)
<T> void
addMessageHandler(java.lang.Class<T> clazz, jakarta.websocket.MessageHandler.Partial<T> handler)
<T> void
addMessageHandler(java.lang.Class<T> clazz, jakarta.websocket.MessageHandler.Whole<T> handler)
void
close()
void
close(jakarta.websocket.CloseReason closeReason)
void
closeInternal()
void
closeInternal(jakarta.websocket.CloseReason closeReason)
void
forceClose()
jakarta.websocket.RemoteEndpoint.Async
getAsyncRemote()
jakarta.websocket.RemoteEndpoint.Basic
getBasicRemote()
ServerWebSocketContainer
getContainer()
Encoding
getEncoding()
java.util.concurrent.Executor
getExecutor()
java.lang.String
getId()
int
getMaxBinaryMessageBufferSize()
long
getMaxIdleTimeout()
int
getMaxTextMessageBufferSize()
java.util.Set<jakarta.websocket.MessageHandler>
getMessageHandlers()
java.util.List<jakarta.websocket.Extension>
getNegotiatedExtensions()
java.lang.String
getNegotiatedSubprotocol()
java.util.Set<jakarta.websocket.Session>
getOpenSessions()
java.util.Map<java.lang.String,java.lang.String>
getPathParameters()
java.lang.String
getProtocolVersion()
java.lang.String
getQueryString()
java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getRequestParameterMap()
java.net.URI
getRequestURI()
java.security.Principal
getUserPrincipal()
java.util.Map<java.lang.String,java.lang.Object>
getUserProperties()
io.undertow.websockets.core.WebSocketChannel
getWebSocketChannel()
boolean
isOpen()
boolean
isSecure()
void
removeMessageHandler(jakarta.websocket.MessageHandler messageHandler)
void
setMaxBinaryMessageBufferSize(int i)
void
setMaxIdleTimeout(long milliseconds)
void
setMaxTextMessageBufferSize(int i)
void
setReceiveListener(org.xnio.ChannelListener<io.undertow.websockets.core.WebSocketChannel> handler)
sets the recieve listener This should only be used for annotated endpoints.
-
-
-
Method Detail
-
getContainer
public ServerWebSocketContainer getContainer()
- Specified by:
getContainer
in interfacejakarta.websocket.Session
-
addMessageHandler
public void addMessageHandler(jakarta.websocket.MessageHandler messageHandler) throws java.lang.IllegalStateException
- Specified by:
addMessageHandler
in interfacejakarta.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 interfacejakarta.websocket.Session
-
addMessageHandler
public <T> void addMessageHandler(java.lang.Class<T> clazz, jakarta.websocket.MessageHandler.Partial<T> handler)
- Specified by:
addMessageHandler
in interfacejakarta.websocket.Session
-
getMessageHandlers
public java.util.Set<jakarta.websocket.MessageHandler> getMessageHandlers()
- Specified by:
getMessageHandlers
in interfacejakarta.websocket.Session
-
removeMessageHandler
public void removeMessageHandler(jakarta.websocket.MessageHandler messageHandler)
- Specified by:
removeMessageHandler
in interfacejakarta.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 interfacejakarta.websocket.Session
-
getNegotiatedSubprotocol
public java.lang.String getNegotiatedSubprotocol()
- Specified by:
getNegotiatedSubprotocol
in interfacejakarta.websocket.Session
-
isSecure
public boolean isSecure()
- Specified by:
isSecure
in interfacejakarta.websocket.Session
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfacejakarta.websocket.Session
-
getMaxIdleTimeout
public long getMaxIdleTimeout()
- Specified by:
getMaxIdleTimeout
in interfacejakarta.websocket.Session
-
setMaxIdleTimeout
public void setMaxIdleTimeout(long milliseconds)
- Specified by:
setMaxIdleTimeout
in interfacejakarta.websocket.Session
-
getId
public java.lang.String getId()
- Specified by:
getId
in interfacejakarta.websocket.Session
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejakarta.websocket.Session
- Throws:
java.io.IOException
-
close
public void close(jakarta.websocket.CloseReason closeReason) throws java.io.IOException
- Specified by:
close
in interfacejakarta.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 interfacejakarta.websocket.Session
-
getRequestParameterMap
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestParameterMap()
- Specified by:
getRequestParameterMap
in interfacejakarta.websocket.Session
-
getQueryString
public java.lang.String getQueryString()
- Specified by:
getQueryString
in interfacejakarta.websocket.Session
-
getPathParameters
public java.util.Map<java.lang.String,java.lang.String> getPathParameters()
- Specified by:
getPathParameters
in interfacejakarta.websocket.Session
-
getUserProperties
public java.util.Map<java.lang.String,java.lang.Object> getUserProperties()
- Specified by:
getUserProperties
in interfacejakarta.websocket.Session
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
- Specified by:
getUserPrincipal
in interfacejakarta.websocket.Session
-
setMaxBinaryMessageBufferSize
public void setMaxBinaryMessageBufferSize(int i)
- Specified by:
setMaxBinaryMessageBufferSize
in interfacejakarta.websocket.Session
-
getMaxBinaryMessageBufferSize
public int getMaxBinaryMessageBufferSize()
- Specified by:
getMaxBinaryMessageBufferSize
in interfacejakarta.websocket.Session
-
setMaxTextMessageBufferSize
public void setMaxTextMessageBufferSize(int i)
- Specified by:
setMaxTextMessageBufferSize
in interfacejakarta.websocket.Session
-
getMaxTextMessageBufferSize
public int getMaxTextMessageBufferSize()
- Specified by:
getMaxTextMessageBufferSize
in interfacejakarta.websocket.Session
-
getAsyncRemote
public jakarta.websocket.RemoteEndpoint.Async getAsyncRemote()
- Specified by:
getAsyncRemote
in interfacejakarta.websocket.Session
-
getBasicRemote
public jakarta.websocket.RemoteEndpoint.Basic getBasicRemote()
- Specified by:
getBasicRemote
in interfacejakarta.websocket.Session
-
getOpenSessions
public java.util.Set<jakarta.websocket.Session> getOpenSessions()
- Specified by:
getOpenSessions
in interfacejakarta.websocket.Session
-
getNegotiatedExtensions
public java.util.List<jakarta.websocket.Extension> getNegotiatedExtensions()
- Specified by:
getNegotiatedExtensions
in interfacejakarta.websocket.Session
-
getEncoding
public Encoding getEncoding()
-
getWebSocketChannel
public io.undertow.websockets.core.WebSocketChannel getWebSocketChannel()
-
getExecutor
public java.util.concurrent.Executor getExecutor()
-
-