首页 > 编程语言 > 详细

springMvc web项目中restful风格的api路径中有小数点会被过滤后台拿不到最后一个小数点的问题

时间:2019-11-29 19:04:28      阅读:92      评论:0      收藏:0      [点我收藏+]

 有两种解决方案:

1:在api路径中加入:.+

1 @RequestMapping("/findByIp/{ip:.+}")
2    public Object test(@PathVariable String ip) {
3        System.out.println(ip);
4        return "";
5   }

但这种方式在web服务中感觉太过于鸡肋

 

所以在springMvc.xml中配置mvc标签

2.<mvc:path-matching registered-suffixes-only="true"/>

1 <mvc:annotation-driven >
2     <mvc:path-matching registered-suffixes-only="true"/>
3 </mvc:annotation-driven>

 

 

原文链接:

https://blog.csdn.net/weixin_42599091/article/details/82666646

 

声明:此博客为个人学习之用,如与其他作品雷同,纯属巧合,转载请指明出处!

springMvc web项目中restful风格的api路径中有小数点会被过滤后台拿不到最后一个小数点的问题

原文:https://www.cnblogs.com/zhihuifan10/p/11959186.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!