Restful风格接口的路径参数包含点号(.)的处理

http://localhost:8080/user/getUserDetail/xiao.gang 路径参数中使用了点号“.”,传递进来的参数只有点号前边的字符串xiao,解决办法是在后端请求映射中做如下修改:

@RequestMapping("/user/getUserDetail/{account:.+}")
public User getUserDetail(@PathVariable(“account”)){
return User ;
}

或者做如下修改:
@RequestMapping("/user/getUserDetail/")
public User getUserDetail(@RequestParam String account){
return User ;
}

你可能感兴趣的:(java基础)