Java – how to run common code for most requests in spring MVC web app?

Namely

I mapped various URLs using spring MVC requestmapping

@RequestMapping(value = "/mystuff",method = RequestMethod.GET) 
@RequestMapping(value = "/mystuff/dsf",method = RequestMethod.GET) 
@RequestMapping(value = "/mystuff/eee",method = RequestMethod.GET)

wait

I want to run some common operations before about 90% of the requests These are across several controllers

In any case, do this without an in-depth study of AOP? If I have to use aspects, any guidance on how to do this?!

thank you!

More information:

It's running some application specific security - we're linked to the parent security settings, we need to read and call, and then we need to access cookies before most of our calls, but not all

Solution

You can use the Interceptor:

http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html#mvc -handlermapping

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>