Announcement Announcement Module
No announcement yet.
PathVariable endings on com Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • PathVariable endings on com

    Good day everyone!

    I'm using Spring4 and I have annotation defined @RestController. That controller has a mapping
    @RequestMapping(value = "/remindPassword/{usernameOrEmail}", method = RequestMethod.GET)
    public ResultTO<Boolean> remindPassword(@PathVariable String usernameOrEmail) {
    In my Spring config file there is <mvc:annotation-driven/>, so for the class RequestMappingHandlerMapping I've turned off useSuffixPatternMatch and useRegisteredSuffixPatternMatch via BeanPostProcessor in order to not have PathVariable truncation as described at

    Requests like /remindPassword/test.test work. When I send a request like /remindPassword/, I get 406 error. For some reason content negotiation strategy for such requests tries to guess extension application/x-msdownload, which is wrong because real extension is application/json, so request fails.

    Is there a way to turn off that media type guess mechanism completely? Unfortunately using trailing "/" in request (so request looks like /remindPassword/ is not an option.

    Best regards,

  • #2
    This question is probably a better candidate for StackOverflow, perhaps with the "spring-mvc" tag.

    Could you post your question there?
    The forums are moving to stackoverflow, a page explaining all this will be available there in a few days: