String postUrl=";
String timestamp=String.valueOf(timestamp());
String hash=md5(apiKey+timestamp);
HttpPost post = new HttpPost(postUrl);
HttpClient client = HttpClientBuilder.create().build();
ArrayList<BasicNameValuePair> pairList = new ArrayList<>();
pairList.add(new BasicNameValuePair("taskType","distribute"));
pairList.add(new BasicNameValuePair("name",name));
pairList.add(new BasicNameValuePair("hash",hash));
pairList.add(new BasicNameValuePair("timestamp",timestamp));
JSONObject json = new JSONObject();
json.put("files","http://bj.oss.qiyi.storage/content-brain/Jellyfish.jpg");
json.put("fileArea",2);
json.put("httpBackurl","http://www.baidu.com");
pairList.add(new BasicNameValuePair("data",json.toJSONString()));
post.setEntity(new UrlEncodedFormEntity(pairList,"utf-8"));
HttpResponse resp = client.execute(post);
System.out.println("响应头:" + resp.getStatusLine().getStatusCode());
if (resp.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = resp.getEntity();
String msg = EntityUtils.toString(entity, "utf-8");
System.out.println(msg);
} else {
System.out.println("请求失败");
}