Announcement Announcement Module
Collapse
No announcement yet.
PathVariable endings on com Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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
    Code:
    @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 http://stackoverflow.com/questions/3...ting-truncated.

    Requests like /remindPassword/test.test work. When I send a request like /remindPassword/test.com, 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/test.com/) is not an option.

    Best regards,
    Eugene

  • #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: http://spring.io/questions

    Comment

    Working...
    X