Class XrootdRequestHandler

  • All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
    Direct Known Subclasses:
    XrootdAuthorizationHandler, XrootdProtocolRequestHandler

    public class XrootdRequestHandler
    extends io.netty.channel.ChannelInboundHandlerAdapter
    A ChannelInboundHandler to dispatch xrootd events to handler methods. Default response to all request messages from a client is kXR_Unsupported. Sub-classes may override handler methods to implement request handling. Releases the reference to XrootdRequest if the handler method throws an exception or returns a response. If the handler returns null the subclass assumes responsibility to release the request, typically by passing it on the next ChannelHandler in the pipeline.
    • 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
      void channelActive​(io.netty.channel.ChannelHandlerContext ctx)  
      void channelRead​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg)  
      protected java.lang.Object doOnAuthentication​(io.netty.channel.ChannelHandlerContext ctx, AuthenticationRequest msg)  
      protected java.lang.Object doOnClose​(io.netty.channel.ChannelHandlerContext ctx, CloseRequest msg)  
      protected java.lang.Object doOnDirList​(io.netty.channel.ChannelHandlerContext ctx, DirListRequest msg)  
      protected java.lang.Object doOnEndSession​(io.netty.channel.ChannelHandlerContext ctx, EndSessionRequest request)  
      protected java.lang.Object doOnLocate​(io.netty.channel.ChannelHandlerContext ctx, LocateRequest msg)  
      protected java.lang.Object doOnLogin​(io.netty.channel.ChannelHandlerContext ctx, LoginRequest msg)  
      protected java.lang.Object doOnMkDir​(io.netty.channel.ChannelHandlerContext ctx, MkDirRequest msg)  
      protected java.lang.Object doOnMv​(io.netty.channel.ChannelHandlerContext ctx, MvRequest msg)  
      protected java.lang.Object doOnOpen​(io.netty.channel.ChannelHandlerContext ctx, OpenRequest msg)  
      protected java.lang.Object doOnPrepare​(io.netty.channel.ChannelHandlerContext ctx, PrepareRequest msg)  
      protected java.lang.Object doOnProtocolRequest​(io.netty.channel.ChannelHandlerContext ctx, ProtocolRequest msg)  
      protected java.lang.Object doOnQuery​(io.netty.channel.ChannelHandlerContext ctx, QueryRequest msg)  
      protected java.lang.Object doOnRead​(io.netty.channel.ChannelHandlerContext ctx, ReadRequest msg)  
      protected java.lang.Object doOnReadV​(io.netty.channel.ChannelHandlerContext ctx, ReadVRequest msg)  
      protected java.lang.Object doOnRm​(io.netty.channel.ChannelHandlerContext ctx, RmRequest msg)  
      protected java.lang.Object doOnRmDir​(io.netty.channel.ChannelHandlerContext ctx, RmDirRequest msg)  
      protected java.lang.Object doOnSet​(io.netty.channel.ChannelHandlerContext ctx, SetRequest request)  
      protected java.lang.Object doOnStat​(io.netty.channel.ChannelHandlerContext ctx, StatRequest msg)  
      protected java.lang.Object doOnStatx​(io.netty.channel.ChannelHandlerContext ctx, StatxRequest msg)  
      protected java.lang.Object doOnSync​(io.netty.channel.ChannelHandlerContext ctx, SyncRequest msg)  
      protected java.lang.Object doOnWrite​(io.netty.channel.ChannelHandlerContext ctx, WriteRequest msg)  
      protected java.net.InetSocketAddress getDestinationAddress()
      The socket address the client connected to.
      protected java.net.InetSocketAddress getSourceAddress()
      The socket address the client connected from.
      protected boolean isHealthCheck()
      True if this looks like a health check connection from a proxy server.
      protected void requestReceived​(io.netty.channel.ChannelHandlerContext ctx, XrootdRequest req)  
      protected io.netty.channel.ChannelFuture respond​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object response)  
      protected <T extends XrootdRequest>
      XrootdResponse<T>
      unsupported​(io.netty.channel.ChannelHandlerContext ctx, T msg)  
      void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt)  
      protected <T extends XrootdRequest>
      ErrorResponse<T>
      withError​(io.netty.channel.ChannelHandlerContext ctx, T req, int errorCode, java.lang.String errMsg)  
      protected <T extends XrootdRequest>
      OkResponse<T>
      withOk​(T req)  
      • Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

        channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
      • 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

      • XrootdRequestHandler

        public XrootdRequestHandler()
    • Method Detail

      • channelActive

        public void channelActive​(io.netty.channel.ChannelHandlerContext ctx)
                           throws java.lang.Exception
        Specified by:
        channelActive in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
        Throws:
        java.lang.Exception
      • channelRead

        public void channelRead​(io.netty.channel.ChannelHandlerContext ctx,
                                java.lang.Object msg)
                         throws java.lang.Exception
        Specified by:
        channelRead in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
        Throws:
        java.lang.Exception
      • userEventTriggered

        public void userEventTriggered​(io.netty.channel.ChannelHandlerContext ctx,
                                       java.lang.Object evt)
                                throws java.lang.Exception
        Specified by:
        userEventTriggered in interface io.netty.channel.ChannelInboundHandler
        Overrides:
        userEventTriggered in class io.netty.channel.ChannelInboundHandlerAdapter
        Throws:
        java.lang.Exception
      • requestReceived

        protected void requestReceived​(io.netty.channel.ChannelHandlerContext ctx,
                                       XrootdRequest req)
      • withError

        protected <T extends XrootdRequestErrorResponse<T> withError​(io.netty.channel.ChannelHandlerContext ctx,
                                                                       T req,
                                                                       int errorCode,
                                                                       java.lang.String errMsg)
      • respond

        protected io.netty.channel.ChannelFuture respond​(io.netty.channel.ChannelHandlerContext ctx,
                                                         java.lang.Object response)
      • getDestinationAddress

        protected java.net.InetSocketAddress getDestinationAddress()
        The socket address the client connected to. May be the local address of the channel, but could also be an address on a proxy server between the client and the server.
      • getSourceAddress

        protected java.net.InetSocketAddress getSourceAddress()
        The socket address the client connected from. May be the remote address of the channel, but in case a proxy is in between the client and the server, the source address will be a different from the remote address.
      • isHealthCheck

        protected boolean isHealthCheck()
        True if this looks like a health check connection from a proxy server.