将拦截器应用于连接为Spring @Component的Jersey RESTful服务 [英] Applying interceptor to Jersey RESTful service wired as Spring @Component
问题描述
是否可以应用Spring handler拦截器或类似于Jersey Restful服务的东西? Jersey服务是使用Spring构建的,是否在Spring @Component中?
Is it possible to apply a Spring handler interceptor or something similar to a Jersey Restful service? The Jersey service is built with Spring and is inside a Spring @Component?
我注意到Spring允许对控制器使用处理程序拦截器,但找不到任何可与我的Jersey-Rest组件一起使用的东西
I noticed that Spring allows the use of handler interceptors for controllers but cant find anything to work with my Jersey-Rest component
谢谢
推荐答案
Jersey带有自己的servlet,因此,它远远超出了Interceptor所属的Spring MVC.您可以:
Jersey comes with its own servlet and therefore is pretty much outside of Spring MVC, which the Interceptors are part of. You can either:
- 使用Spring HTTP过滤器在Jersey周围按摩HTTPServletRequest和HTTPServletResponse
- 在Jersey内的Spring组件周围使用Spring Handled方面来按摩方法调用和结果.
This guy here did a great job summing up the nuts and bolts: http://www.mkyong.com/webservices/jax-rs/jersey-spring-integration-example/
这篇关于将拦截器应用于连接为Spring @Component的Jersey RESTful服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!