SpringMVC 中HttpMessageConverter简介和Http请求415 Unsupported Media Type的问题
HttpMessageConverter。<!--- StringHttpMessageConverter bean -->
< bean id = "stringHttpMessageConverter" class = "org.springframework.http.converter.StringHttpMessageConverter"/> <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
< bean class ="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" >
< property name= "messageConverters" >
< list>
< ref bean= "mappingJacksonHttpMessageConverter" />
<!-- 新增的StringMessageConverter bean-->
< ref bean= "stringHttpMessageConverter" />
< ref bean= "jsonHttpMessageConverter" />
< ref bean= "formHttpMessageConverter" />
</ list>
</ property>
</ bean>
四、HttpMessageConverter请求信息转换器简介:
- ByteArrayHttpMessageConverter: 负责读取二进制格式的数据和写出二进制格式的数据;
- StringHttpMessageConverter: 负责读取字符串格式的数据和写出二进制格式的数据;
- ResourceHttpMessageConverter:负责读取资源文件和写出资源文件数据;
- FormHttpMessageConverter: 负责读取form提交的数据(能读取的数据格式为 application/x-www-form-urlencoded,不能读取multipart/form-data格式数据);负责写入application/x-www-from-urlencoded和multipart/form-data格式的数据;
- MappingJacksonHttpMessageConverter: 负责读取和写入json格式的数据;
- SourceHttpMessageConverter: 负责读取和写入 xml 中javax.xml.transform.Source定义的数据;
- Jaxb2RootElementHttpMessageConverter: 负责读取和写入xml 标签格式的数据;
- AtomFeedHttpMessageConverter: 负责读取和写入Atom格式的数据;
- RssChannelHttpMessageConverter: 负责读取和写入RSS格式的数据;
SpringMVC 中HttpMessageConverter简介和Http请求415 Unsupported Media Type的问题的更多相关文章
- springMVC中使用 RequestBody 及 Ajax POST请求 415 (Unsupported Media Type)
使用POST请求的时候一直报错: Ajax 未设置 contentType 时会报 415 . 后台 RequestBody 承接前台参数,故对参数data的要求为“必传”“JSON”,否则会报40 ...
- Ajax请求(415 Unsupported Media Type)
Unsupported media type-415(不支持的媒体类型) 该错误类型是后台接收参数为json类型的,然而ajax提交的类型不对,如下: 异常代码: $.ajax({ url: api ...
- [.NET Core]ASP.NET Core中如何解决接收表单时的不支持的媒体类型(HTTP 415 Unsupported Media Type)错误呢?
[.NET Core]ASP.NET Core中如何解决接收表单时的不支持的媒体类型(HTTP 415 Unsupported Media Type)错误呢? 在ASP.NET Core应用程序中,接 ...
- RestTemplate远程调用POST请求:HTTP 415 Unsupported Media Type
这是本项目的接口 称为client @POST @Path("/{urlcode}") @Consumes(MediaTypes.JSON_UTF_8) @Produces(Med ...
- angularjs - 415 (Unsupported Media Type)
angularJs+springMVC angular表单提交一个user实体时,报 angularjs - 415 (Unsupported Media Type)错误!! 原因是$http({ u ...
- request 报错The remote server returned an error: (415) Unsupported Media Type.
开发时遇到个问题,程序访问数据库数据,给服务器发送请求时,老是报错,返回的错误页面是: HTTP Status 415 - Unsupported Media Type type Status rep ...
- Darwin Streaming Server服务器mp4文件点播返回”415 Unsupported Media Type“错误
Darwin Streaming Server中mp4文件点播失败,通过抓包发现服务器返回”415 Unsupported Media Type“错误,如下: RTSP/ Unsupported Me ...
- System.Net.WebException : The remote server returned an error: (415) UNSUPPORTED MEDIA TYPE
I am having problems with a bit of code that accesses a restful web service. Running this code, it e ...
- 415 Unsupported Media Type
415 Unsupported Media Type - HTTP | MDN https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415
随机推荐
- Effective Java 14 In public classes, use accessor methods, not public fields
Principle To offer the benefits of encapsulation you should always expose private field with public ...
- Effective Java 16 Favor composition over inheritance
Inheritance disadvantage Unlike method invocation, inheritance violates encapsulation. Since you don ...
- Eclipse,myeclipse开发中常用技巧总结
一.myeclipse自带包和自己部署的包冲突解决问题方案 原来的依赖设置: 修改后的配置: 二.取消Myeclipse的自动文件验证来增加myeclipse速度 1.Windows –> Pe ...
- 烂泥:KVM使用裸设备配置虚拟机
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 何谓裸设备?百度百科显示: 裸设备(raw device),也叫裸分区(原始分区),是一种没有经过格式化,不被Unix通过文件系统来读取的特殊块设备文件 ...
- [译]OpenStack Object Storage Monitoring
注:翻译的不完整,主要是有些地方翻译后反而妨碍理解,有些不知道怎么翻,anyway,需要时拿来用用也是可行的,顺便共享啦.欢迎提意见. 一个OpenStack Object Storage(OSOS) ...
- tarjan算法+缩点:求强连通分量 POJ 2186
强连通分量:1309. [HAOI2006]受欢迎的牛 ★★ 输入文件:cow.in 输出文件:cow.out 简单对比时间限制:1 s 内存限制:128 MB [题目描述] 每一头牛 ...
- codeforces 711A A. Bus to Udayland(水题)
题目链接: A. Bus to Udayland 题意: 找一对空位坐下来,水; 思路: AC代码: #include <iostream> #include <cstdio> ...
- SQL里面如何取得前N条数据?
select * from table order by id limit 10 运用limit可以获取前N个数据
- 三维网格形变算法(Laplacian-Based Deformation)
网格上顶点的Laplace坐标(均匀权重)定义为:,其中di为顶点vi的1环邻域顶点数. 网格Laplace坐标可以用矩阵形式表示:△=LV,其中,那么根据网格的Laplace坐标通过求解稀疏线性方程 ...
- Android外部SD卡的读取
package com.kevin.writeorreadfile1_1; import android.app.Activity; import android.bluetooth.le.ScanF ...