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
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNettyServerWebSocketUpgradeHandler(NettyEmbeddedServices embeddedServices, io.micronaut.http.netty.websocket.WebSocketSessionRepository webSocketSessionRepository) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) protected final voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest<?> msg) protected 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.voidhandlerRemoved(io.netty.channel.ChannelHandlerContext ctx) Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded
-
Field Details
-
ID
- See Also:
-
SCHEME_WEBSOCKET
- See Also:
-
SCHEME_SECURE_WEBSOCKET
- See Also:
-
COMPRESSION_HANDLER
- See Also:
-
-
Constructor Details
-
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 Details
-
acceptInboundMessage
- 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 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
-
handlerRemoved
- Specified by:
handlerRemovedin interfaceio.netty.channel.ChannelHandler- Overrides:
handlerRemovedin classio.netty.channel.ChannelHandlerAdapter- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-