Class 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acceptInboundMessage​(java.lang.Object msg)  
      protected void channelRead0​(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest<?> msg)  
      protected java.lang.String getWebSocketURL​(io.netty.channel.ChannelHandlerContext ctx, io.micronaut.http.HttpRequest req)
      Obtains the web socket URL.
      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.
      • Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

        channelRead
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
    • Constructor Detail

      • NettyServerWebSocketUpgradeHandler

        public NettyServerWebSocketUpgradeHandler​(NettyEmbeddedServices embeddedServices,
                                                  io.micronaut.http.netty.websocket.WebSocketSessionRepository webSocketSessionRepository)
        Default constructor.
        Parameters:
        embeddedServices - The embedded server services
        webSocketSessionRepository - The websocket session repository
    • Method Detail

      • acceptInboundMessage

        public boolean acceptInboundMessage​(java.lang.Object msg)
        Overrides:
        acceptInboundMessage in class io.netty.channel.SimpleChannelInboundHandler<NettyHttpRequest<?>>
      • channelRead0

        protected final void channelRead0​(io.netty.channel.ChannelHandlerContext ctx,
                                          NettyHttpRequest<?> msg)
        Specified by:
        channelRead0 in class io.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 context
        req - The request
        webSocketBean - The web socket bean
        response - 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 context
        req - The request
        Returns:
        The socket URL