@ChannelHandler.Sharable
public class Router
extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpRequest>
| Modifier and Type | Field and Description |
|---|---|
protected jauter.Router<java.lang.Object> |
anyMethodRouter |
protected io.netty.util.concurrent.EventExecutorGroup |
group |
protected io.netty.channel.ChannelInboundHandler |
handler404 |
static java.lang.String |
ROUTED_HANDLER_NAME |
static java.lang.String |
ROUTER_HANDLER_NAME |
protected java.util.Map<io.netty.handler.codec.http.HttpMethod,jauter.Router<java.lang.Object>> |
routers |
| Constructor and Description |
|---|
Router() |
Router(io.netty.channel.ChannelInboundHandler handler404) |
Router(io.netty.util.concurrent.EventExecutorGroup group) |
Router(io.netty.util.concurrent.EventExecutorGroup group,
io.netty.channel.ChannelInboundHandler handler404) |
| Modifier and Type | Method and Description |
|---|---|
void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest req) |
static io.netty.channel.ChannelFuture |
keepAliveWriteAndFlush(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest req,
io.netty.handler.codec.http.HttpResponse res) |
static io.netty.channel.ChannelFuture |
keepAliveWriteAndFlush(io.netty.channel.Channel ch,
io.netty.handler.codec.http.HttpRequest req,
io.netty.handler.codec.http.HttpResponse res) |
java.lang.String |
name()
Should be used to add the router to pipeline:
channel.pipeline().addLast(router.name(), router)
|
java.lang.String |
path(io.netty.handler.codec.http.HttpMethod method,
io.netty.channel.ChannelInboundHandler handlerInstance,
java.lang.Object... params) |
java.lang.String |
path(io.netty.handler.codec.http.HttpMethod method,
java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass,
java.lang.Object... params) |
Router |
pattern(io.netty.handler.codec.http.HttpMethod method,
java.lang.String path,
io.netty.channel.ChannelInboundHandler handlerInstance) |
Router |
pattern(io.netty.handler.codec.http.HttpMethod method,
java.lang.String path,
java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass) |
Router |
patternFirst(io.netty.handler.codec.http.HttpMethod method,
java.lang.String path,
io.netty.channel.ChannelInboundHandler handlerInstance) |
Router |
patternFirstFirst(io.netty.handler.codec.http.HttpMethod method,
java.lang.String path,
java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass) |
Router |
patternLast(io.netty.handler.codec.http.HttpMethod method,
java.lang.String path,
io.netty.channel.ChannelInboundHandler handlerInstance) |
Router |
patternLast(io.netty.handler.codec.http.HttpMethod method,
java.lang.String path,
java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass) |
void |
removePath(java.lang.String path) |
void |
removeTarget(java.lang.Object target) |
acceptInboundMessage, channelReadchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredhandlerAdded, handlerRemoved, isSharablepublic static final java.lang.String ROUTER_HANDLER_NAME
public static final java.lang.String ROUTED_HANDLER_NAME
protected final java.util.Map<io.netty.handler.codec.http.HttpMethod,jauter.Router<java.lang.Object>> routers
protected final jauter.Router<java.lang.Object> anyMethodRouter
protected final io.netty.util.concurrent.EventExecutorGroup group
protected final io.netty.channel.ChannelInboundHandler handler404
public Router()
public Router(io.netty.channel.ChannelInboundHandler handler404)
public Router(io.netty.util.concurrent.EventExecutorGroup group)
public Router(io.netty.util.concurrent.EventExecutorGroup group,
io.netty.channel.ChannelInboundHandler handler404)
public java.lang.String name()
public Router pattern(io.netty.handler.codec.http.HttpMethod method, java.lang.String path, io.netty.channel.ChannelInboundHandler handlerInstance)
public Router pattern(io.netty.handler.codec.http.HttpMethod method, java.lang.String path, java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass)
public Router patternFirst(io.netty.handler.codec.http.HttpMethod method, java.lang.String path, io.netty.channel.ChannelInboundHandler handlerInstance)
public Router patternFirstFirst(io.netty.handler.codec.http.HttpMethod method, java.lang.String path, java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass)
public Router patternLast(io.netty.handler.codec.http.HttpMethod method, java.lang.String path, io.netty.channel.ChannelInboundHandler handlerInstance)
public Router patternLast(io.netty.handler.codec.http.HttpMethod method, java.lang.String path, java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass)
public void removeTarget(java.lang.Object target)
public void removePath(java.lang.String path)
public void channelRead0(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest req)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.HttpRequest>java.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionpublic java.lang.String path(io.netty.handler.codec.http.HttpMethod method,
io.netty.channel.ChannelInboundHandler handlerInstance,
java.lang.Object... params)
public java.lang.String path(io.netty.handler.codec.http.HttpMethod method,
java.lang.Class<? extends io.netty.channel.ChannelInboundHandler> handlerClass,
java.lang.Object... params)
public static io.netty.channel.ChannelFuture keepAliveWriteAndFlush(io.netty.channel.ChannelHandlerContext ctx,
io.netty.handler.codec.http.HttpRequest req,
io.netty.handler.codec.http.HttpResponse res)
public static io.netty.channel.ChannelFuture keepAliveWriteAndFlush(io.netty.channel.Channel ch,
io.netty.handler.codec.http.HttpRequest req,
io.netty.handler.codec.http.HttpResponse res)