Class HttpServerUpgradeHandler

  • All Implemented Interfaces:
    ChannelHandler, ChannelInboundHandler

    public class HttpServerUpgradeHandler
    extends HttpObjectAggregator
    A server-side handler that receives HTTP requests and optionally performs a protocol switch if the requested protocol is supported. Once an upgrade is performed, this handler removes itself from the pipeline.
    • Method Detail

      • beginAggregation

        protected FullHttpMessage beginAggregation​(HttpMessage start,
                                                   ByteBuf content)
                                            throws java.lang.Exception
        Description copied from class: MessageAggregator
        Creates a new aggregated message from the specified start message and the specified content. If the start message implements ByteBufHolder, its content is appended to the specified content. This aggregator will continue to append the received content to the specified content.
        Overrides:
        beginAggregation in class HttpObjectAggregator
        Throws:
        java.lang.Exception
      • shouldHandleUpgradeRequest

        protected boolean shouldHandleUpgradeRequest​(HttpRequest req)
        Determines whether the specified upgrade HttpRequest should be handled by this handler or not. This method will be invoked only when the request contains an Upgrade header. It always returns true by default, which means any request with an Upgrade header will be handled. You can override this method to ignore certain Upgrade headers, for example:
        {@code