Java EE 中的请求和响应编码问题 - 相关API汇总
来源:互联网 发布:python分布式读取 编辑:程序博客网 时间:2024/05/22 08:14
request setContentType 不存在
request getContentType "获取请求正文的 MIME 类型. 如果未知, null" (详解,API[1])
request setCharacterEncoding 覆写请求体的编码. [2]
request getCharacterEncoding 获取请求体的的编码, 如未定义, null. [3]
//
response setContentType "设置响应正文的 MIME 类型" (详解)
response getContentType "返回响应正文的 MIME 类型" (详解)
response setCharacterEncoding "设置响应正文的字符编码, 默认为 ISO-8859-1" (详解)
response getCharacterEncoding "返回响应正文的字符编码" (详解)
参考原文:
[1] String getContentType()
Returns the MIME type of the body of the request, or null if the type is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_TYPE.
Returns:
a String containing the name of the MIME type of the request, or null if the type is not known
[2] Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader(). Otherwise, it has no effect.
"覆盖"请求体中的编码名称. 必须在读取参数和输入流之前设置, 否则无效.
[3] String getCharacterEncoding()
Returns the name of the character encoding used in the body of this request. This method returns null if the request does not specify a character encoding
Returns:
a String containing the name of the character encoding, or null if the request does not specify a character encoding
详解 : 孙卫琴《Tomcat 与 Java Web 开发技术详解》
注意 : request 的3个 API 都写明了是"body of the request", 也就是只针对请求体, 不是请求头.
- Java EE 中的请求和响应编码问题 - 相关API汇总
- 【Java EE】get和post请求|响应的编码过程
- Java EE 请求响应对象
- Http响应和请求的编码问题
- 【Java EE】get和post请求的编码过程
- 全站编码问题 请求和响应编码的处理
- JAva Excel api 中的编码和中文问题
- Java EE 中编码问题
- Java ee+tomcat相关问题
- HTTP请求和响应中 中文urlEncode urlDecode编码问题
- 请求和响应编码处理
- 通过过滤器解决post方式请求参数编码问题和响应编码问题
- Java编码问题汇总
- Java编码问题汇总
- Java编码问题汇总
- Java编码问题汇总
- Java编码问题汇总
- Java编码问题汇总
- Android之Loader理解
- JAVA中的下拉框(Combo Box)概述(1)
- Android事件传递机制2
- Java 7之基础 - 学习Java类必须知道的几点
- hdu 1240 Asteroids! (广搜)
- Java EE 中的请求和响应编码问题 - 相关API汇总
- 【深入浅出Objective-C】8.2数组(NSArray)和集合(NSSet)
- Python学习笔记(八)异常
- 使用bower安装angular-ui-router时release目录为空
- TSX之有限事务内存,TSX之锁消除技术 和 lock free 编程之比较(有效总结)
- 全网视频网站破解序言
- Struts2国际化
- the most right digit of N^N.
- JNDI 与 EJB