| 限定符和类型 | 类和说明 |
|---|---|
protected class |
Chain.IntMap<E>
...-2,-1,0,1,2..
|
protected class |
Chain.Node
执行链路节点
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected cn.xnatural.xchain.Lazier<cn.xnatural.xchain.Counter> |
_counter
时间段统计器
|
protected static org.slf4j.Logger |
log |
protected Map<String,Chain.Node> |
protocolMap
协议处理器节点链
|
protected IMvc<T> |
server |
| 限定符和类型 | 方法和说明 |
|---|---|
Chain<T> |
filter(String protocol,
String prefix,
int order,
Handler<T> handler)
添加Filter
|
protected boolean |
handle(PathHandler<T> h,
T ctx)
执行某个
RouteHandler |
protected boolean |
handle(T ctx)
执行此Chain
|
protected void |
handleNoMatch(T ctx)
处理未有匹配的处理器
|
String |
logStr(String protocol,
String id,
String method,
String path) |
Map<String,Object> |
openApi() |
protected void |
preMatch(Chain.Node first)
计算节点的可跳跃节点
节点匹配结果代码
RouteHandler.match(Context)
Chain.Node.matchJump 匹配结果代码 -> 跳跃的目的节点
|
Chain<T> |
register(PathHandler<T> handler)
注册
PathHandler
按优先级PathHandler.compareTo(PathHandler)}的比较结果添加 |
Chain<T> |
resolve(Collection ctrls)
|
Chain<T> |
resolve(Object... ctrls)
|
Chain<T> |
resolve(Object ctrl)
|
protected void |
resolve(Object ctrl,
Method method)
解析路由,可扩展自定义注释
子类重写添加其他解析
|
protected void |
resolveFilter(Object ctrl,
Method method)
解析
Filter |
protected void |
resolveRoute_preProcess(Object ctrl,
Method method,
Set<String> paths,
Set<String> protocols,
Set<String> methods,
Set<String> consumes,
Set<String> produces) |
protected void |
resolveRoute(Object ctrl,
Method method)
解析
Route |
Chain<T> |
route(String path,
Consumer<T> handler)
指定路径处理器
|
Chain<T> |
route(String path,
Handler<T> handler)
指定路径处理器
|
Chain<T> |
route(String protocol,
String path,
Consumer<T> handler)
指定路径和协议处理器
|
Chain<T> |
route(String protocol,
String path,
Matchable<T> matcher,
Handler<T> handler)
指定路径和协议处理器
|
protected RouteHandler<T> |
routeHandler(String protocol,
String path,
Set<String> method,
Set<String> consume,
Set<String> produce,
Handler<T> handler)
创建一个
RouteHandler
用于子类重写 |
String |
toString() |
protected static final org.slf4j.Logger log
protected final Map<String,Chain.Node> protocolMap
protected final cn.xnatural.xchain.Lazier<cn.xnatural.xchain.Counter> _counter
protected boolean handle(T ctx)
ctx - Contextprotected boolean handle(PathHandler<T> h, T ctx) throws Throwable
RouteHandlerThrowableprotected void handleNoMatch(T ctx)
public Chain<T> register(PathHandler<T> handler)
PathHandler
按优先级PathHandler.compareTo(PathHandler)}的比较结果添加protected void preMatch(Chain.Node first)
计算节点的可跳跃节点 节点匹配结果代码RouteHandler.match(Context)Chain.Node.matchJump匹配结果代码 -> 跳跃的目的节点
public Chain<T> route(String protocol, String path, Matchable<T> matcher, Handler<T> handler)
protocol - Route.protocol()path - Route.path()matcher - 匹配函数, 可由运行时逻辑动态决定是否匹配handler - 处理器Chainpublic Chain<T> route(String path, Handler<T> handler)
path - Route.path()handler - 处理器Chainpublic Chain<T> route(String protocol, String path, Consumer<T> handler)
protocol - Route.protocol()path - Route.path()handler - 处理器Chainpublic Chain<T> route(String path, Consumer<T> handler)
path - Route.path()handler - 处理器Chainpublic Chain<T> filter(String protocol, String prefix, int order, Handler<T> handler)
protocol - Filter.protocol()prefix - Filter.prefix()handler - HandlerChainpublic Chain<T> resolve(Collection ctrls)
protected void resolveFilter(Object ctrl, Method method)
Filterctrl - 控制层对象method - 方法protected void resolveRoute(Object ctrl, Method method)
Routectrl - 控制层对象method - 方法protected void resolveRoute_preProcess(Object ctrl, Method method, Set<String> paths, Set<String> protocols, Set<String> methods, Set<String> consumes, Set<String> produces)
protected RouteHandler<T> routeHandler(String protocol, String path, Set<String> method, Set<String> consume, Set<String> produce, Handler<T> handler)
RouteHandler
用于子类重写Copyright © 2023. All rights reserved.