Search in sources :

Example 1 with Processor

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;
                }
            }
        }
    }
}
Also used : Processor(org.nutz.mvc.Processor) ActionFilter(org.nutz.mvc.ActionFilter) ObjectInfo(org.nutz.mvc.ObjectInfo)

Example 2 with 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);
    }
}
Also used : Processor(org.nutz.mvc.Processor) ArrayList(java.util.ArrayList)

Aggregations

Processor (org.nutz.mvc.Processor)2 ArrayList (java.util.ArrayList)1 ActionFilter (org.nutz.mvc.ActionFilter)1 ObjectInfo (org.nutz.mvc.ObjectInfo)1