java – 如何在Spring MVC Web App中为大多数请求运行公共代码?
发布时间:2020-12-14 05:44:45 所属栏目:Java 来源:网络整理
导读:即 我使用Spring MVC RequestMapping映射了各种URL @RequestMapping(value = "/mystuff",method = RequestMethod.GET) @RequestMapping(value = "/mystuff/dsf",method = RequestMethod.GET) @RequestMapping(value = "/mystuff/eee",method = RequestMethod
即
我使用Spring MVC RequestMapping映射了各种URL @RequestMapping(value = "/mystuff",method = RequestMethod.GET) @RequestMapping(value = "/mystuff/dsf",method = RequestMethod.GET) @RequestMapping(value = "/mystuff/eee",method = RequestMethod.GET) 等等 我希望在大约90%的请求之前运行一些常见操作.这些是跨几个控制器. 无论如何在没有深入研究AOP的情况下做到这一点?如果我必须使用方面,任何指导如何做到这一点?! 谢谢! 更多信息: 它是运行某些应用程序特定的安全性 – 我们被链接到父安全设置,我们需要读取和调用,然后需要在我们的大多数调用之前访问cookie,但不是全部. 解决方法
你可以使用拦截器:
http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-handlermapping (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |