Http学习之使用HttpURLConnection发送post和get请求(2)
接上节Http学习之使用HttpURLConnection发送post和get请求
本节深入学习post请求。
上
节说道,post请求的OutputStream实际上不是网络流,而是写入内存,在getInputStream中才真正把写道流里面的内容作为正文与
根据之前的配置生成的http request头合并成真正的http request,并在此时才真正向服务器发送。
HttpURLConnection.setChunkedStreamingMode
函数可以改变这个模式,设置了ChunkedStreamingMode后,不再等待OutputStream关闭后生成完整的http
request一次过发送,而是先发送http
request头,正文内容则是网路流的方式实时传送到服务器。实际上是不告诉服务器http正文的长度,这种模式适用于向服务器传送较大的或者是不容易
获取长度的数据,如文件。下面以一段代码讲解一下,请与Http学习之使用HttpURLConnection发送post和get请求中的readContentFromPost()函数作对比:
public static void readContentFromChunkedPost() throws IOException {
URL postUrl = new URL(POST_URL);
HttpURLConnection connection = (HttpURLConnection) postUrl
.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setUseCaches(false);
connection.setInstanceFollowRedirects(true);
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
/*
* 与readContentFromPost()最大的不同,设置了块大小为5字节
*/
connection.setChunkedStreamingMode(5);
connection.connect();
/*
* 注意,下面的getOutputStream函数工作方式于在readContentFromPost()里面的不同
* 在readContentFromPost()里面该函数仍在准备http request,没有向服务器发送任何数据
* 而在这里由于设置了ChunkedStreamingMode,getOutputStream函数会根据connect之前的配置
* 生成http request头,先发送到服务器。
*/
DataOutputStream out = new DataOutputStream(connection
.getOutputStream());
String content = "firstname=" + URLEncoder.encode("一个大肥人 " +
" " +
"asdfasfdasfasdfaasdfasdfasdfdasfs", "utf-8");
out.writeBytes(content); out.flush();
out.close(); // 到此时服务器已经收到了完整的http request了,而在readContentFromPost()函数里,要等到下一句服务器才能收到http请求。
BufferedReader reader = new BufferedReader(new InputStreamReader(
connection.getInputStream())); out.flush();
out.close(); // flush and close
String line;
System.out.println("=============================");
System.out.println("Contents of post request");
System.out.println("=============================");
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
System.out.println("=============================");
System.out.println("Contents of post request ends");
System.out.println("=============================");
reader.close();
connection.disconnect();
}
输出
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAisAAAHSCAIAAACiuRwzAAAgAElEQVR4nO3dy7mzNhSF4VMXBVEP0/SRhz4ydjFkYAO6rC3EdYP9vZPk5xgQIFhIGPnvn3//GwAAuNwfCQQAcEECAQB8kEAAAB9BAr265i/S9kxk4nETASBGGwgA4IM2EBNpAwHwQRsIAOCDBAIA+CCBAAA+SCAAgA8SCADggwQCAPgggQAAPkggAICPX0ig+fXIpnt5FwYA8JEmUN9Or7FvuFy/umbP2+87Zzf07SXJc07hj/eUcgL4fmECvbpm5/Apd0ygq664T7myP6WcAL5fMi6cujQFY3yNf+7bv7YbJ78bGNlIYGO747jZF1oy2YrWDE4mimQUXhTJLPzimqalLq1onNy30Sy1s28oJwCcbU6gV9eIK1I4df7/vg0vifNFLw+x4Io5d4fVzx7NX6LLaSxUCIo0zW4s0yhSbduib+cr/7gocy99ps7LlgkkZ99bTgA420ICJZcrccWMPpFd3dK77unaWjf7tIClS6ZRTmOhgpjDWqZRpBUJpGbN9lL4+KqcQHon7y0nAJwt6IWLmiMfexNIfwtgRQIFZSvl0JUJZBRpRwLJvVSfQOWvWmwtJwCcbembCGYvnIyQ/GKoYm3F7ElJyhG0sxcueEo1ty30MuWiK79zpzrHrPAPH99MCSQnFjdxUzkB4GzJt7GDL2OHDyvSB9dmhIh3b8I+ovwJxcLs4lm8SZRTrGFx5mh2sUy7SHXvHenHM2IvzdPafp5pmth0XbwbdSfc5nICwNl+4Y3UGrXfePBBzxmAb0QCvZFAAHA1EuiNBAKAq5FAAAAfJBAAwAcJBADwQQIBAHyQQAAAHyQQAMAHCQQA8JH8PlCk7ZnIxOMmAkCMNhAAwAdtICbSBgLggzYQAMAHCQQA8EECAQB8kEAAAB8kEADABwkEAPBBAgEAfJBAAAAfJBAAwAcJBADwQQIBAHyQQAAAHyQQAM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AOCDBAIA+PiFBJpfj2y6l3dhvtqra3j3FEC1NIH6dnqNfcPleucV6JwLWN9ekjxPufqeWc6n7AMA9xAm0Ktrdg6fcscEuuqq+JSrLwkE4C6SceHU5SMY42v8c9/+td04+d3AyEYCG9sdx82+0JLJVrRmcDJRJKPwokhm4RfXNC11aUXj5L6NZqmdfUM5Kw+cUc41Bw7Ar5oT6NU14lIRTp3/v2/DS+J80ctDLLhizt1h9bNH85fochoLFYIiTbMbyzSKVHv/37fzJXlclLmXPlPnZcsEkrPvLGf9gZPlrD5wAH7YQgIllytxxYw+kV3d0rvu6UJWN/u0gKWLmVFOY6GCmMNaplGkFQmkZs32Uvj4qpxAeifvK2f9gdPlrD1wAH5Z0AsXNUc+9iaQ/hbAigQKyla6nF2ZQEaRdiSQ3Ev1CVT+qsW2ctYfOCOBjLUDwGzpmwhmL5yMkPzCpWJtxexJScoRtLMXLnjYMbct9DLloiu/c6e6p6zwDx/fTAkkJxY3cUs5qw+cLqe5dgCYJN/GDr6MHT6sSJ8omxEi3r0J+3PyJxQLs8tn3AZRTrGGxZmj2cUy7SLVvXekH5CIvTRPa/t5pmli03XxbtSdcJvLWX/gVDnXHDgAv+oX3kitce8H5zQjAHwjEuiNBAKAq5FAbyQQAFyNBAIA+CCBAAA+SCAAgA8SCADggwQCAPgggQAAPkggAICP5PeBIm3PRCYeNxEAYrSBAAA+aAMxkTYQAB+0gQAAPkggAIAPEggA4IMEAgD4IIEAAD5IIACADxIIAOCDBAIA+CCBAAA+SCAAgA8SCADggwQCAPgggQAAPkggAIAPEggA4IMEAgD4IIEAAD5IIACADxIIAOCDBAIA+CCBAAA+SCAAgA8SCADggwQCAPgggQAAPkggAIAPEggA4IMEAgD4IIEAAD5IIACADxIIAOCDBAIA+CCBAAA+SCAAgA8SCADggwQCAPgggQAAPkggAIAPEggA4ON/ww/upqVIdkUAAAAASUVORK5CYII=" alt="" />
Http学习之使用HttpURLConnection发送post和get请求(2)的更多相关文章
- Http学习之使用HttpURLConnection发送post和get请求(3)
使用HttpURLConnection发送post和get请求 但我们常常会碰到这样一种情况: 通过HttpURLConnection来模拟模拟用户登录Web服务器,服务器使用cookie进行用户认证 ...
- Http学习之使用HttpURLConnection发送post和get请求(1)
最常用的Http请求无非是get和post,get请求可以获取静态页面,也可以把参数放在URL字串后面,传递给servlet,post与get的不同之处在于post的参数不是放在URL字串里面,而是放 ...
- HttpURLConnection发送GET、POST请求
HttpURLConnection发送GET.POST请求 /** * GET请求 * * @param requestUrl 请求地址 * @return */ public String get( ...
- 谈谈Java利用原始HttpURLConnection发送POST数据
这篇文章主要给大家介绍java利用原始httpUrlConnection发送post数据,设计到httpUrlConnection类的相关知识,感兴趣的朋友跟着小编一起学习吧 URLConnectio ...
- HttpUrlConnection发送url请求(后台springmvc)
1.HttpURLConnection发送url请求 public class JavaRequest { private static final String BASE_URL = "h ...
- HTTPURLConnection 发送Post数据
在使用HTTPURLConnection发送POST数据时,通常使用如下方式: byte[] body = new byte[512]; // 需要发送的body数据 URL url = new UR ...
- HttpURLConnection发送POST请求(可包含文件)
import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io. ...
- JAVA使用原始HttpURLConnection发送POST数据
package com.newflypig.demo; /** * 使用jdk自带的HttpURLConnection向URL发送POST请求并输出响应结果 * 参数使用流传递,并且硬编码为字符串&q ...
- HttpURLConnection发送请求
每个 HttpURLConnection 实例都可用于生成单个请求,但是其他实例可以透明地共享连接到 HTTP 服务器的基础网络.请求后在 HttpURLConnection 的 InputStrea ...
随机推荐
- IDEA 根据数据库表 生成 Model实体
首先在 Idea中 配置数据源,测试ok(过程略) idea窗口中左下角是否 有显示Persistence 窗口 如果没有显示就要如下方法 添加显示: File - > Project Str ...
- DataTable 转实体
因为Linq的查询功能很强大,所以从数据库中拿到的数据为了处理方便,我都会转换成实体集合List<T>. 开始用的是硬编码的方式,好理解,但通用性极低,下面是控件台中的代码: using ...
- MySQL数据库的安装布局
首先我们要安装(mysql-5.0.18-win32_zip) 第一步:点击(Setup.exe) 第二步:开始安装(MySQL Server5.0版本) 1.点击(Next) 2.选Custom自定 ...
- 微信小程序,前端大梦想(四)
微信小程序图片轮播及滚动视图 移动端常用效果图片轮播及数据列表已被小程序封装成了组件,这里和大家分享一下如何使用. Scroll-view 可滚动视图区域 Swiper 图片轮播容器 ...
- jdk动态代理与cglib代理、spring aop代理实现原理解析
原创声明:本博客来源为本人原创作品,绝非他处摘取,转摘请联系博主 代理(proxy)的定义:为某对象提供代理服务,拥有操作代理对象的功能,在某些情况下,当客户不想或者不能直接引用另一个对象,而代理对象 ...
- Java 代码安全(一) —— 避免用String储存敏感数据
Java 代码安全(一) -- 避免用String储存敏感数据 如果重要的数据(保存在内存中)在使用后没有及时清理,有可能会导致信息泄漏.开发人员通常都回用String 保存敏感数据(密码, ...
- Native App和Web App 的差异
开发者们都知道在高端智能手机系统中有两种应用程序:一种是基于本地(操作系统)运行的APP:一种是基于高端机的浏览器运行的WebApp,本文将主要讲解后者. WebApp与Native App有何区别呢 ...
- PHP环境搭建之PHPstorm9+PHP5开发环境配置
以前写过一篇zend studio+WAMP的:点这里,个人感觉写得不怎么好可是阅读数却上千了... 不过笔者身边好多人开始用PHPStrom了,所以就简单的写个教程 一.下载安装 PHPStrom下 ...
- office web apps 部署-搭建office web apps服务器
二.搭建office web apps服务器 相关文件可以去焰尾迭分享的百度网盘下载,下载地址:http://pan.baidu.com/s/1o6tCo8y#path=%252Foffice%252 ...
- app性能测试【通过loadrunner录制】
随着智能手机近年来的快速增长,从游戏娱乐到移动办公的各式各样的手机APP软件渗透到我们的生活中,对于大型的手机APP测试不仅要关注它的功能性.易用性还要关注它的性能,最近发现LoadRunner12可 ...