Package org.glassfish.tyrus.servlet
Class TyrusHttpUpgradeHandler
java.lang.Object
org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler
- All Implemented Interfaces:
jakarta.servlet.http.HttpUpgradeHandler
,jakarta.servlet.ReadListener
,EventListener
public class TyrusHttpUpgradeHandler
extends 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.
- Author:
- Jitendra Kotamraju, Pavel Bucek
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The size to precede OutOfMemory Exception and potentially DDoS attacks when buffering incoming WebSocket frames. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
void
init
(jakarta.servlet.http.WebConnection wc) void
void
void
void
preInit
(WebSocketEngine.UpgradeInfo upgradeInfo, Writer writer, boolean authenticated) Sets the required information beforeinit(WebConnection)
is invoked.void
Called when relatedHttpSession
is destroyed or invalidated.void
setIncomingBufferSize
(int incomingBufferSize) Override the defaultFRAME_BUFFER_SIZE
.toString()
-
Field Details
-
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.
- See Also:
-
-
Constructor Details
-
TyrusHttpUpgradeHandler
public TyrusHttpUpgradeHandler()
-
-
Method Details
-
init
public void init(jakarta.servlet.http.WebConnection wc) - Specified by:
init
in interfacejakarta.servlet.http.HttpUpgradeHandler
-
preInit
Sets the required information beforeinit(WebConnection)
is invoked.- Parameters:
upgradeInfo
- The WebSocket UpgradeInfo.writer
- The Tyrus SPI Writer.authenticated
- Whether the authentication has been used.
-
onDataAvailable
public void onDataAvailable()- Specified by:
onDataAvailable
in interfacejakarta.servlet.ReadListener
-
onAllDataRead
public void onAllDataRead()- Specified by:
onAllDataRead
in interfacejakarta.servlet.ReadListener
-
onError
- Specified by:
onError
in interfacejakarta.servlet.ReadListener
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.http.HttpUpgradeHandler
-
sessionDestroyed
public void sessionDestroyed()Called when relatedHttpSession
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.
-
toString
-
setIncomingBufferSize
public void setIncomingBufferSize(int incomingBufferSize) Override the defaultFRAME_BUFFER_SIZE
.- Parameters:
incomingBufferSize
- The new incoming frame buffer size value.
-