Announcement Announcement Module
Collapse
No announcement yet.
Problems after @PathVariable parameter value containing the '/' character Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems after @PathVariable parameter value containing the '/' character

    Hi,all:
    I have a use case. Spring MVC REST Url receive content using the GET method code is as follows:
    Code:
    @RequestMapping("/q/{key}")
    public String query(@PathVariable() String key, Model model){
        //todo
    }
    But the front end of such a request :"/q/SiGeC%2FSi%E5%BC%82%E8%B4%A8%E7%BB%93". '%2F' decoded character '/'. The controller can not match mapping request. How should I do?

    by Howsun.
    Thanks!

  • #2
    Annotations of @ PathVariable may not be able to solve this problem.Last use the workaround is resolved.Code is as follows:
    Code:
    @RequestMapping("/q/**")

    Comment

    Working...
    X