HttpServletRequest的getInputStream方法和getParameter方法
来源:互联网 发布:reeder 3 for mac 编辑:程序博客网 时间:2024/06/05 02:46
根据Servlet规范,如果同时满足下列条件,则请求体(Entity)中的表单数据,将被填充到request的parameter集合中(request.getParameter系列方法可以读取相关数据):
1 这是一个HTTP/HTTPS请求
2 请求方法是POST(querystring无论是否POST都将被设置到parameter中)
3 请求的类型(Content-Type头)是application/x-www-form-urlencoded
4 Servlet调用了getParameter系列方法
如果上述条件没有同时满足,则相关的表单数据不会被设置进request的parameter集合中,相关的数据可以通过request.getInputStream()来访问。反之,如果上述条件均满足,相关的表单数据将不能再通过request.getInputStream()来读取。
Servlet Specifiaction 3.0:
引用
3.1.1 When Parameters Are AvailableThe following are the conditions that mustbe met before post form data will be populated to the parameter set:1. The request is an HTTP or HTTPS request.2. The HTTP method is POST.3. The content type is application/x-www-form-urlencoded.4. The servlet has made an initial call of any of the getParameterfamily of methods on the request object.If the conditions are not met and the post form data is not included in the parameter set, the post data must still be available to the servlet via the request object’s input stream. If the conditions are met, post form data will no longer be available for reading directly from the request object’s input stream.
0 0
- HttpServletRequest的getInputStream方法和getParameter方法
- HttpServletRequest的getParameter方法
- HttpServletRequest中的getAttribute方法和getParameter方法的区别
- HttpServletRequest的getInputStream方法与getReader方法的区别
- HttpServletRequest的getInputStream方法与getReader方法的区别
- getInputStream方法getParameter与getReader方法的区别
- HttpServletRequest类的getAttribute()方法与getParameter()方法的区别
- HttpServletRequest类,方法getAttribute()和getParameter()有何区别
- (转)servlet/jsp中得到表单数据的3种方法request.getParameter()、request.getInputStream()和request.getReader()
- HttpServletRequest 的 getAttribute()和getParameter()
- 传智播客java web学习,HttpServletRequest的getInputStream方法与getReader方法的区别
- Socket 的方法 getOutputStream() 和 getInputStream()
- Socket的getInputStream()方法
- Mock HttpServletRequest的getInputStream
- 区分HttpServletRequest 中getAttribute() 与 getParameter() 方法
- getParameter() getInputStream()和getReader() 区别
- getParameter() getInputStream()和getReader() 区别
- getParameter方法和getAttribute方法的区别
- 一句话调用水波浪圆环倒计时
- 排序算法之希尔排序 java实现
- File I/O
- centos如何修改默认语言
- 卡特兰数 Catalan 数
- HttpServletRequest的getInputStream方法和getParameter方法
- bugs—npm install -g grunt-cli fail
- MyEclipse+Tomcat+MAVEN+SVN项目完整环境搭建
- 从request获取各种路径总结
- poj 3832&&hdu 3265 扫描线+线段树
- Redis主从复制机制分析
- Spring IOC(控制反转)和DI(依赖注入)
- FFmpeg Metadata
- ElasticSearch5.0.0安装