Spring restful web service编码乱码问题
来源:互联网 发布:cf总出现网络异常 编辑:程序博客网 时间:2024/05/16 19:39
转自:http://blog.csdn.net/cm_0914/article/details/8003335
Spring MVC从3.0开始支持REST
- Spring MVC从3.0开始支持REST,主要是通过@PathVariable来处理请求参数和路径的映射.假设在Controller中定义了如下的请求映射
@RequestMapping(value = "/account/{key}")
如果请求路径里有中文(如/account/全聚德),可能会有乱码问题,通过设置服务器的编码可以解决,对于Tomcat,只需要修改conf/server.xml文件,添加URIEncoding="UTF-8"即可,如:
- Spring MVC从3.0开始支持REST,主要是通过@PathVariable来处理请求参数和路径的映射.假设在Controller中定义了如下的请求映射
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
- 如果路径中有点"."(如/account/abc.def.ghi),Spring会当作文件扩展名的点来处理,这时Controller中就只能取到最后一个点之前的数据,即abc.def,解决办法是修改请求映射的定义为以下形式:
@RequestMapping(value = "/account/{keyword:.*}")
java:
@Controller@RequestMapping(value = "/labelAction")public class TabLabelController {@RequestMapping(value = "/findLabels/{groupid}/{searchKeyWord}", method = RequestMethod.GET)public Service findById(@PathVariable("groupid") String groupid,@PathVariable("searchKeyWord") String searchKeyWord) {}}调用:htt://sdfsfsf/labelAction/findInGroup/112.xml
- Spring restful web service编码乱码问题
- Spring restful web service编码乱码问题
- Spring restful web service编码乱码问题
- 搭建spring RESTful Web Service
- Spring Web MVC实现Restful Web Service
- Spring Web MVC实现Restful Web Service
- Spring 4.x实现Restful web service
- Spring 4.x实现Restful web service
- 使用spring创建一个RESTful Web Service
- Spring Boot 创建RESTful Web Service
- Spring Building a RESTful Web Service
- Spring Boot创建一个RESTful Web Service
- Spring Boot: Building a RESTful Web Service
- Web-----乱码--编码问题
- spring mvc4 restful api 乱码问题
- [Spring] Spring 3.0对RESTful web service的支持
- 【Spring官方指南学习】Spring构建一个 restful web service
- Restful Web Service (1)
- 统计推断(第四章)
- 演化理解 ANDROID 异步加载图片
- sicily 1294 高级机密
- java中指定字符串是否包含一个字串。(比如判断邮箱是否含有@)
- 脚本编程语言
- Spring restful web service编码乱码问题
- 用opencv查看视频信息(视频的宽度、高度、帧率和总得帧数)
- x264 编码之 psy ,psy_rd [学习笔记 三]
- ubuntu完全卸载firefox
- win8种启用摄像有拍照并保存图片到本地
- 程序员必备的正则表达式
- GIMP入门——利用颜色选择工具抠图
- ubuntu 10.04 LTS 安装google拼音
- JAVA中的类型和对象(Integer和Int)