0

I have a controller with @RequestMapping for root path "/". There are other controllers with say a @RequestMapping of "/test" etc. My application seems to be mapping correctly for paths like /appname/test, but if I add a trailing slash to the path, like so "/appname/test/ then it maps to the controller that has the @RequestMapping for root path "/". Any idea why?

Update:

I also tried removing <mvc:annotation-driven /> and replacing with

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"
   p:order="0" p:alwaysUseFullPath="true" /> 
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" 
   p:alwaysUseFullPath="true"/> 

That fixed the trailing slash problem, but my validations stopped working

Eqbal
  • 4,722
  • 12
  • 38
  • 47

1 Answers1

1

Looks like a bug (SPR-7064), fixed in 3.0.3, should be out soon.

skaffman
  • 398,947
  • 96
  • 818
  • 769
  • hmm, wondering how petclinic sample works okay! It was built with 3.0.0. My app is on 3.0.2, maybe I will go back to 3.0.0 – Eqbal Jun 09 '10 at 22:16
  • @Eqbal: Alternatively, you could add more path mappings as a workaround. `@RequestMapping` can take multiple paths. – skaffman Jun 09 '10 at 22:19
  • That does not work, anything with a trailing slash maps to root. – Eqbal Jun 09 '10 at 22:33