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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyServerWebSocketUpgradeHandler(NettyEmbeddedServices embeddedServices, io.micronaut.http.netty.websocket.WebSocketSessionRepository webSocketSessionRepository)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
     
    protected final void
    channelRead0(io.netty.channel.ChannelHandlerContext ctx, NettyHttpRequest<?> msg)
     
    protected 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.
    void
    handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
     

    Methods inherited from class io.netty.channel.SimpleChannelInboundHandler

    channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, 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
  • Field Details

  • Constructor Details

    • 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 Details

    • acceptInboundMessage

      public boolean acceptInboundMessage(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 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
    • handlerRemoved

      public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      handlerRemoved in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerRemoved in class io.netty.channel.ChannelHandlerAdapter
      Throws:
      Exception
    • channelInactive

      public void channelInactive(@NonNull io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception