美文网首页技术分享疑难杂症|Bug|坑
SpringBoot @PathVariable请求路径出现点号

SpringBoot @PathVariable请求路径出现点号

作者: 依然慢节奏 | 来源:发表于2019-10-13 11:47 被阅读0次

springboot使用@PathVariable路径参数,当请求路径中含有【.】符号,点符号后面的会被截断,解决方法如下:
解决办法:

  • 添加:.+在逗号分隔处;
 @GetMapping("video/{fileName:.+}")
public void video(@PathVariable(value = "fileName") String fileName, HttpServletResponse response) throws IOException {
      ......
}

欢迎关注南阁公众号

南阁子也

相关文章

网友评论

    本文标题:SpringBoot @PathVariable请求路径出现点号

    本文链接:https://www.haomeiwen.com/subject/iinxyctx.html