use of org.nutz.mvc.Processor in project nutz by nutzam.
the class ActionFiltersProcessor method init.
public void init(NutConfig config, ActionInfo ai) throws Throwable {
ObjectInfo<? extends ActionFilter>[] filterInfos = ai.getFilterInfos();
if (null != filterInfos) {
for (int i = 0; i < filterInfos.length; i++) {
ActionFilter filter = evalObj(config, filterInfos[i]);
filters.add(filter);
if (filter instanceof Processor) {
Processor processor = (Processor) filter;
if (proxyProcessor == null) {
proxyProcessor = processor;
lastProcessor = processor;
} else {
processor.setNext(proxyProcessor);
proxyProcessor = processor;
}
}
}
}
}
use of org.nutz.mvc.Processor in project nutz by nutzam.
the class NutActionChainMaker method eval.
public ActionChain eval(NutConfig config, ActionInfo ai) {
try {
List<Processor> list = new ArrayList<Processor>();
for (String name : co.getProcessors(ai.getChainName())) {
Processor processor = getProcessorByName(config, name);
if (processor != null) {
processor.init(config, ai);
list.add(processor);
}
}
Processor errorProcessor = getProcessorByName(config, co.getErrorProcessor(ai.getChainName()));
errorProcessor.init(config, ai);
/*
* 返回动作链实例
*/
return new NutActionChain(list, errorProcessor, ai);
} catch (Throwable e) {
if (log.isDebugEnabled())
log.debugf("Eval FAIL!! : %s", ai.getMethod(), e);
throw Lang.wrapThrow(e);
}
}
Aggregations