Announcement Announcement Module
Collapse
No announcement yet.
interceptor on a single handler mapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • interceptor on a single handler mapping

    Hi,

    I've got a web context with an <mvc:annotation-driven /> tag to setup RequestMappingHandlerMapping for simple annotated controllers and a org.springframework.webflow.mvc.servlet.FlowHandle rMapping for a web flow.
    I'm trying to setup an interceptor (OpenEntityManagerInViewInterceptor) to apply to my simple annotated controllers but not to my web flow.
    I've tried to use <mvc:interceptors ...> but that registers my interceptor on both mappings. How can I set it up only on my RequestMappingHandlerMapping?

    I know I can filter my interceptors on request path, but that's not what I want, I just want the interceptor to apply to one mapping and not the other.

    Thanks

  • #2
    The only way to do that is to do manual configuration of the HandlerMapping and register the interceptors yourself, at least if url mapping isn't sufficient.

    Comment


    • #3
      OK, so what is the exact translation of <mvc:annotation-driven />?
      In other words, if I remove <mvc:annotation-driven /> from my context, what beans should I define instead?

      Comment


      • #4
        That depends on what you use/configure. You need at least the RequestMappingHandlerMapping/-HandlerAdapter...

        Comment


        • #5
          That depends???

          My question is what would I need to manually define to have an exact same context as this one without using the mvc:annotation-driven tag?
          Code:
          <beans xmlns="http://www.springframework.org/schema/beans" 
                     xmlns:mvc="http://www.springframework.org/schema/mvc"	
          	   xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
                     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
          
          	<mvc:annotation-driven  />
          </beans>

          Comment


          • #6
            Yes it depends.. It depends how you have configured annotation-driven, do you use it to serve static instances, do you have/use JSR-303 validation, do you use JSON/XML etc. So yes it depends, it depends on your settings and available jars!

            If you want the exact thing take a look at the source code for AnnotationDrivenBeanDefinitionParser (in the org.springframework.web.servlet.config) to know what you need depeding on YOUR environment.

            And as already mentioned in the previous post at a minimum you need the RequestMappingHandlerMapping/-HandlerAdapter.

            Comment

            Working...
            X