Class JRouterHttpRequestHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
net.jrouter.http.netty.JRouterHttpRequestHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class JRouterHttpRequestHandler extends io.netty.channel.ChannelInboundHandlerAdapter
提供适配HttpServerActionFactory接受FullHttpRequest请求参数的处理类。
  • 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 char
    默认的路径分隔符。
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    protected String
    parseActionPath(io.netty.handler.codec.http.FullHttpRequest request)
    A hook to give subclass another way to create Action's invoke path.
    void
    setContextPath(String contextPath)
     
    protected void
    writeHttpResponse(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request, io.netty.handler.codec.http.FullHttpResponse response)
    Write http response.
    protected void
    writeHttpResponse(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request, io.netty.handler.codec.http.FullHttpResponse response, Object invokedRes)
    Write http response.

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

    • PATH_SEPARATOR

      public static final char PATH_SEPARATOR
      默认的路径分隔符。
      See Also:
  • Constructor Details

    • JRouterHttpRequestHandler

      public JRouterHttpRequestHandler(HttpServerActionFactory httpServerActionFactory)
      Constructor.
      Parameters:
      httpServerActionFactory - HttpServerActionFactory object.
  • Method Details

    • channelRead

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

      protected String parseActionPath(io.netty.handler.codec.http.FullHttpRequest request)
      A hook to give subclass another way to create Action's invoke path.
      Parameters:
      request - FullHttpRequest object.
      Returns:
      Action's invoke path.
    • writeHttpResponse

      protected void writeHttpResponse(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request, io.netty.handler.codec.http.FullHttpResponse response)
      Write http response.
    • writeHttpResponse

      protected void writeHttpResponse(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request, io.netty.handler.codec.http.FullHttpResponse response, Object invokedRes)
      Write http response.
    • setContextPath

      public void setContextPath(String contextPath)