简体   繁体   English

如何映射弹簧拦截器

[英]How to map Spring Interceptor

I'm trying to map a Spring Interceptor so it catches every '*.do' request, but I can only make it work in a 'single level'. 我试图映射一个Spring Interceptor,以便它捕获每个“ * .do”请求,但我只能使其在“单个级别”下工作。

My Interceptor mapping path is "/*.do", and I can only intercept URIs like /app/action.do 我的拦截器映射路径是“ /*.do”,我只能拦截/app/action.do之类的URI。

If I request /app/ anotherLevel /action.do the Interceptor is not triggered. 如果我请求/ app / anotherLevel /action.do,则不会触发拦截器。

I've noticed that mapping path = "/*/*.do" catches 'second level' requests, but that does not look correct. 我注意到映射路径=“ /*/*.do”捕获了“第二级”请求,但这看起来并不正确。

What should be the value of interceptor mapping path so I can intercept all *.do request regardless of the level? 拦截器映射路径的值应该是多少,以便无论级别如何都可以拦截所有* .do请求?

Thanks a lot and sorry for any english mistakes. 非常感谢,对于任何英语错误,我们深表歉意。

I finally figured out how to map every level. 我终于弄清楚了如何绘制每个级别。

There was a slash missing, so the correct value should be /**/*.do . 缺少斜线,因此正确的值应该是/**/*.do

I found the trick in the link below: 我在下面的链接中找到了窍门:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-localeresolver-interceptor http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-localeresolver-interceptor

Thanks a lot! 非常感谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM