Class NettyServerWebSocketUpgradeHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<NettyHttpRequest<?>>
-
- io.micronaut.http.server.netty.websocket.NettyServerWebSocketUpgradeHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
@Internal public class NettyServerWebSocketUpgradeHandler extends io.netty.channel.SimpleChannelInboundHandler<NettyHttpRequest<?>>
Handles WebSocket upgrade requests.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMPRESSION_HANDLERstatic java.lang.StringIDstatic java.lang.StringSCHEME_SECURE_WEBSOCKETstatic java.lang.StringSCHEME_WEBSOCKET
-
Constructor Summary
Constructors Constructor Description NettyServerWebSocketUpgradeHandler(NettyEmbeddedServices embeddedServices, io.micronaut.http.netty.websocket.WebSocketSessionRepository webSocketSessionRepository)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptInboundMessage(java.lang.Object msg)protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest<?> msg)protected java.lang.StringgetWebSocketURL(io.netty.channel.ChannelHandlerContext ctx, io.micronaut.http.HttpRequest req)Obtains the web socket URL.protected io.netty.channel.ChannelFuturehandleHandshake(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest req, io.micronaut.websocket.context.WebSocketBean<?> webSocketBean, io.micronaut.http.MutableHttpResponse<?> response)Do the handshaking for WebSocket request.-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
SCHEME_WEBSOCKET
public static final java.lang.String SCHEME_WEBSOCKET
- See Also:
- Constant Field Values
-
SCHEME_SECURE_WEBSOCKET
public static final java.lang.String SCHEME_SECURE_WEBSOCKET
- See Also:
- Constant Field Values
-
COMPRESSION_HANDLER
public static final java.lang.String COMPRESSION_HANDLER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NettyServerWebSocketUpgradeHandler
public NettyServerWebSocketUpgradeHandler(NettyEmbeddedServices embeddedServices, io.micronaut.http.netty.websocket.WebSocketSessionRepository webSocketSessionRepository)
Default constructor.- Parameters:
embeddedServices- The embedded server serviceswebSocketSessionRepository- The websocket session repository
-
-
Method Detail
-
acceptInboundMessage
public boolean acceptInboundMessage(java.lang.Object msg)
- Overrides:
acceptInboundMessagein classio.netty.channel.SimpleChannelInboundHandler<NettyHttpRequest<?>>
-
channelRead0
protected final void channelRead0(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest<?> msg)- Specified by:
channelRead0in classio.netty.channel.SimpleChannelInboundHandler<NettyHttpRequest<?>>
-
handleHandshake
protected io.netty.channel.ChannelFuture handleHandshake(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest req, io.micronaut.websocket.context.WebSocketBean<?> webSocketBean, io.micronaut.http.MutableHttpResponse<?> response)Do the handshaking for WebSocket request.- Parameters:
ctx- The channel handler contextreq- The requestwebSocketBean- The web socket beanresponse- The response- Returns:
- The channel future
-
getWebSocketURL
protected java.lang.String getWebSocketURL(io.netty.channel.ChannelHandlerContext ctx, io.micronaut.http.HttpRequest req)Obtains the web socket URL.- Parameters:
ctx- The contextreq- The request- Returns:
- The socket URL
-
-