NutzCN Logo
问答 nutzwk filter及处理器等 执行顺序
发布于 2831天前 作者 menglinxi 2143 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

web.xml

<filter>
        <filter-name>ShiroFilter</filter-name>
        <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
    </filter>

动态链

var chain={
	"default" : {
		"ps" : [
			  "cn.wizzer.common.processor.LogTimeProcessor",
			  "cn.wizzer.common.processor.GlobalsSettingProcessor",
			  "org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor",
		      "org.nutz.mvc.impl.processor.EncodingProcessor",
		      "org.nutz.mvc.impl.processor.ModuleProcessor",
              "cn.wizzer.common.processor.NutShiroProcessor",
              "cn.wizzer.common.processor.XssSqlFilterProcessor",
		      "org.nutz.mvc.impl.processor.ActionFiltersProcessor",
		      "org.nutz.mvc.impl.processor.AdaptorProcessor",
		      "org.nutz.mvc.impl.processor.MethodInvokeProcessor",
			  "org.nutz.mvc.impl.processor.ViewProcessor"
		],
		"error" : 'org.nutz.mvc.impl.processor.FailProcessor'
	}
};

方法中配置的filter

 @At("/doLogin")
    @Ok("json")
    @Filters(@By(type = AuthenticationFilter.class))
    public Object doLogin(@Attr("loginToken") AuthenticationToken token, HttpServletRequest req, HttpSession session) {}

三者的执行顺序是?

2 回复

@Filters是ActionFiltersProcessor执行的, 然后动态链是NutFilter执行的, 然后web.xml中ShiroFilter一般放在NutFilter之前, 所以可以得出顺序

ShiroFilter --> NutFilter --> 动作链 --> NutShiroProcessor --> ActionFiltersProcessor --> AuthenticationFilter

感谢,先试试

添加回复
请先登陆
回到顶部