public class TyrusGrizzlyFilter
extends org.glassfish.grizzly.filterchain.BaseFilter
Filter implementation, which supposed to be placed into a FilterChain right after HTTP
Filter: HttpServerFilter, HttpClientFilter; depending whether it's server or client side. The
WebSocketFilter handles websocket connection, handshake phases and, when receives a websocket frame -
redirects it to appropriate connection (TyrusEndpointWrapper,
TyrusWebSocket) for processing.| Constructor and Description |
|---|
TyrusGrizzlyFilter(org.glassfish.tyrus.spi.WebSocketEngine websocketEngine,
String contextPath) |
| Modifier and Type | Method and Description |
|---|---|
org.glassfish.grizzly.filterchain.NextAction |
handleClose(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Method handles Grizzly
Connection close phase. |
org.glassfish.grizzly.filterchain.NextAction |
handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
Handle Grizzly
Connection read phase. |
public TyrusGrizzlyFilter(org.glassfish.tyrus.spi.WebSocketEngine websocketEngine,
String contextPath)
public org.glassfish.grizzly.filterchain.NextAction handleClose(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
throws IOException
Connection close phase. Check if the Connection is a TyrusWebSocket, if yes - tries to close the websocket gracefully (sending close frame)
and calls TyrusWebSocket.onClose(org.glassfish.tyrus.core.frame.CloseFrame). If
the Grizzly Connection is not websocket - passes processing to the next filter in the chain.handleClose in interface org.glassfish.grizzly.filterchain.FilterhandleClose in class org.glassfish.grizzly.filterchain.BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it should continue the executionIOExceptionpublic org.glassfish.grizzly.filterchain.NextAction handleRead(org.glassfish.grizzly.filterchain.FilterChainContext ctx)
throws IOException
Connection read phase. If the Connection has associated TyrusWebSocket object (websocket connection), we check if websocket handshake has been
completed for this connection, if not - initiate/validate handshake. If handshake has been completed - parse
websocket Frames one by one and pass processing to appropriate TyrusWebSocket: TyrusEndpointWrapper for server- and
client- side connections.handleRead in interface org.glassfish.grizzly.filterchain.FilterhandleRead in class org.glassfish.grizzly.filterchain.BaseFilterctx - FilterChainContextNextAction instruction for FilterChain, how it should continue the executionIOException - TODOCopyright © 2019. All rights reserved.