1

The original intention was to be able to configure filter mappings with annotations (i.e. @FilteredBy below) instead of adding filter mappings to the web.xml file. Something like:

@Controller
 public class MyController {    
 @RequestMapping(value = "/special/page.html")
 @FilteredBy("SpecialBean")  // <-- *** desired ***
 public String doSpecialStuff() {
  return "special/page";
 }
}

I see that Servlet 3.0 introduces @ServletFilter which can be applied any object method and the mappings are defined by @FilterMapping. However, I want invert the responsibility of the mapping to the controller method consuming the shared logic of my "SpecialBean".

i3ensays
  • 2,804
  • 3
  • 19
  • 23
  • I should also note that I'm stuck on Tomcat 5.5 (Servlet 2.4 API), but was able to introduce Spring 3.0.x into the project. – i3ensays Aug 02 '13 at 00:27

1 Answers1

0

Why not use your spring context xml. If you are using mvc:annotation you can try this.

  <mvc:interceptors>
      <mvc:interceptor>
        <mvc:mapping path="/filtered/page.htm" />
        <bean class="com.yourinterceptor" />
        </mvc:interceptor>
    </mvc:interceptors> 
ArunM
  • 2,274
  • 3
  • 25
  • 47
  • This is an alternative, but I'm looking for an annotation based solution. I'm working toward bundling new code into modules and having each module contain its own configuration is preferred over maintaining a xml file in the parent project. – i3ensays Aug 02 '13 at 17:04
  • The second answer in the question has some clue I think for you. http://stackoverflow.com/questions/4389224/is-it-possible-to-wire-a-spring-mvc-interceptor-using-annotations. Have you got a chance to check this ? – ArunM Aug 04 '13 at 02:31