request的小问题

结贴是美德 2012-01-11 04:42:53
我再看Tomcat的API时,发现这么一段话:

getContentType

java.lang.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

地址为:http://tomcat.apache.org/tomcat-7.0-doc/servletapi/index.html

但是呢,我的工程中调用getContentType总是返回null,通过firfox的插件查看
头信息,确实也没有content-type这一项。浏览器发送的http消息能有body和content-type么? 什么时候才有?
...全文
34 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧