I am confused about the way the DefaultAnnotationHandlerMapping works.
In my web.xml I have
spring&l
Spring will match against the pathInfo
property of the HttpServletRequest
.
If your web.xml
specifies <url-pattern>/user/*</url-pattern>
, then the pathInfo
will be the path with the /user
prefix removed, so the @RequestMapping
has to be /adduser
.
If web.xml
specifies <url-pattern>/user/adduser</url-pattern>
, then the pathInfo
will be the full /user/adduser
path, so @RequestMapping
has to match against that.
This isn't done by Spring, but by the servlet container, and it can be a bit confusing at times.
You can mitigate against this by using wildcards in @RequestMapping
, e.g.
@RequestMapping(value="**/adduser", method={RequestMethod.POST})