-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to restrict HandlerInterceptors to specific controller paths [SPR-4015] #8695
Comments
Scott Murphy commented Ignore the 2nd "however". I lost my wireless internet connection during a post and accidentally resubmitted it before editing. I meant to say this: Annotation-based controller configuration is by far the best controller configuration I have seen to date. However, my current Spring 2.0 configuration is dependent on interceptors. Is there any way we can PLEASE get some type on interceptor support in the 2.5 release?
I will work full time for FREE until the release if you need someone to write it if you can point me in the right direction. |
Juergen Hoeller commented Interceptors can be configured through an explicit "org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" bean definition, using the same "interceptors" property that is available on BeanNameUrlHandlerMapping and SimpleUrlHandlerMapping as well. Such a custom DefaultAnnotationHandlerMapping bean will simply override the default DefaultAnnotationHandlerMapping (which defines no interceptors), following the same approach that DispatcherServlet uses for all of its strategies. I'm not fond of an Juergen |
Scott Murphy commented What happens if you have 2 annotation controllers that each need different interceptors? I am under impression that you can only have one DefaultAnnotationHandlerMapping. Can we create a RestrictedAnnotationHandlerMapping where you specify the urls (or controllers) that are part of that mapping? I tried to extend the DefaultAnnotationHandlerMapping and have a second one with a different order, but it appears that you can not do this. I guess the controller initialization is done in this mapper? (I could not view the source to org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping. It was not included in the distribution and is also not in the CVS respository using the web browse function from SourceForge) Here would be an example of what I am trying to do: accountInterceptor bankingInterceptor If I set up an interceptor for DefaultAnnotationHandlerMapping it would use it for all the controllers. |
Scott Murphy commented I retract my last comment, I was able to create a RestrictedAnnotationHandlerMapping where I define valid annotation urls. Everything works great now, thanks. You guys have really done a great job with 2.5. I have been using Spring since the 1.x days and I am really impressed with what you have done in 2.5 I'll mention again that org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping is missing from the src directory in the distribution. I don't know if you have a reason for that, but like I also said, I could not find it in CVS browse either. |
Juergen Hoeller commented DefaultAnnotationHandlerMapping lives in the "tiger/src" directory. "src" only contains the parts of Spring that are compiled with "-target 1.4", whereas "tiger/src" gets compiled with "-target 1.5". The "spring-sources.jar" that we provide in the "dist" directory contains all of the sources merged into one tree. Thanks for the praise, BTW :-) Juergen |
Scott Murphy commented Anyone interested in using my classes for having multiple annotation mappers can get them here |
Keith Donald commented Added mvc:interceptors element to Spring 3 MVC namespace which contains a mvc:interceptor element that allows you to define one to many mvc:mappings, allowing the restricting of an interceptor to specific path mappings. |
R. A. commented There should also be a mvc:interceptor mapping parameter to exclude specified path from intercepting. |
Keith Donald commented Please open another Jira describing what you would like added in more detail |
R. A. commented Opened new Jira https://jira.springsource.org/browse/SPR-6570 . Thanks. |
Scott Murphy opened SPR-4015 and commented
Annotation-based controller configuration is by far the best controller configuration I have seen to date. However, my current Spring 2.0 configuration is dependent on interceptors. However, the lack of interceptors has made it unusable to me. Is there any way we can PLEASE get some type on interceptor support in the 2.5 release?
@Interceptor
("interceptorName")I will work full time for FREE until the release if you need someone to write it if you can point me in the right direction.
Affects: 2.5 RC1
Issue Links:
@HandlerInterceptor
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: