Trying to create REST-ful URLs with multiple dots in the “filename” part - Spring 3.0 MVC

后端 未结 7 1579
旧巷少年郎
旧巷少年郎 2020-12-03 02:11

I\'m using Spring MVC (3.0) with annotation-driven controllers. I would like to create REST-ful URLs for resources and be able to not require (but still opt

7条回答
  •  情歌与酒
    2020-12-03 02:26

    The @PathVariable pattern matching is a bit twitchy when it comes to dots in the URL (see SPR-5778). You can make it less twitchy (but more picky), and get better control over dot-heavy URLs, by setting the useDefaultSuffixPattern property on DefaultAnnotationHandlerMapping to false.

    If you haven't already explicitly declared a DefaultAnnotationHandlerMapping in your context (and most people don't since it's declared implicitly for you), then you can add it explicitly, and set that property.

提交回复
热议问题