Package net.jrouter.http.netty
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 -
Constructor Summary
ConstructorsConstructorDescriptionJRouterHttpRequestHandler(HttpServerActionFactory httpServerActionFactory) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) protected StringparseActionPath(io.netty.handler.codec.http.FullHttpRequest request) A hook to give subclass another way to create Action's invoke path.voidsetContextPath(String contextPath) protected voidwriteHttpResponse(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest request, io.netty.handler.codec.http.FullHttpResponse response) Write http response.protected voidwriteHttpResponse(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, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
PATH_SEPARATOR
public static final char PATH_SEPARATOR默认的路径分隔符。- See Also:
-
-
Constructor Details
-
JRouterHttpRequestHandler
Constructor.- Parameters:
httpServerActionFactory- HttpServerActionFactory object.
-
-
Method Details
-
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
parseActionPath
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
-