【发布时间】:2011-09-27 03:52:12
【问题描述】:
是否可以为 HttpPost 设置 2 个实体?喜欢:
HttpPost post = new HttpPost("http://www.abc.com");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("A",
a));
nameValuePairs.add(new BasicNameValuePair("B", b));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
post.setHeader("Accept-Encoding", "gzip");
ByteArrayEntity bae = new ByteArrayEntity(compress(json));
post.setEntity(bae);
HttpResponse resp;
resp = client.execute(post);
我正在尝试实现告诉服务器有一些参数和一个 zip 文件。
【问题讨论】: