public class TyrusHttpUpgradeHandler
extends java.lang.Object
implements jakarta.servlet.http.HttpUpgradeHandler, jakarta.servlet.ReadListener
HttpUpgradeHandler
and ReadListener
implementation.
Reads data from ServletInputStream
and passes it further to the Tyrus runtime.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FRAME_BUFFER_SIZE
The size to precede OutOfMemory Exception and potentially DDoS attacks when buffering incoming WebSocket frames.
|
Constructor and Description |
---|
TyrusHttpUpgradeHandler() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
init(jakarta.servlet.http.WebConnection wc) |
void |
onAllDataRead() |
void |
onDataAvailable() |
void |
onError(java.lang.Throwable t) |
void |
preInit(WebSocketEngine.UpgradeInfo upgradeInfo,
Writer writer,
boolean authenticated)
Sets the required information before
init(WebConnection) is invoked. |
void |
sessionDestroyed()
Called when related
HttpSession is destroyed or invalidated. |
void |
setIncomingBufferSize(int incomingBufferSize)
Override the default
FRAME_BUFFER_SIZE . |
java.lang.String |
toString() |
public static final java.lang.String FRAME_BUFFER_SIZE
The size to precede OutOfMemory Exception and potentially DDoS attacks when buffering incoming WebSocket frames.
The default value is 4194315 bytes, which correspond to 4M plus few bytes to frame headers.
public void init(jakarta.servlet.http.WebConnection wc)
init
in interface jakarta.servlet.http.HttpUpgradeHandler
public void preInit(WebSocketEngine.UpgradeInfo upgradeInfo, Writer writer, boolean authenticated)
init(WebConnection)
is invoked.upgradeInfo
- The WebSocket UpgradeInfo.writer
- The Tyrus SPI Writer.authenticated
- Whether the authentication has been used.public void onDataAvailable()
onDataAvailable
in interface jakarta.servlet.ReadListener
public void onAllDataRead()
onAllDataRead
in interface jakarta.servlet.ReadListener
public void onError(java.lang.Throwable t)
onError
in interface jakarta.servlet.ReadListener
public void destroy()
destroy
in interface jakarta.servlet.http.HttpUpgradeHandler
public void sessionDestroyed()
HttpSession
is destroyed or invalidated.
Implementation is required to call onClose() on server-side with corresponding close code (1008, see WebSocket spec 7.2) - only when there is an authorized user for this session.
public java.lang.String toString()
toString
in class java.lang.Object
public void setIncomingBufferSize(int incomingBufferSize)
FRAME_BUFFER_SIZE
.incomingBufferSize
- The new incoming frame buffer size value.Copyright © 2012–2020 Oracle Corporation. All rights reserved.