一个优秀的http实现框架

 1 package com.ming;
 2 
 3 
 4 
 5 import com.mashape.unirest.http.HttpResponse;
 6 import com.mashape.unirest.http.Unirest;
 7 
 8 public class UnirestUtil {
 9 
10     public static void main(String[] args) throws Exception {
11 
12         HttpResponse<String> jsonResponse = Unirest.post("http://www.baidu.com")
13                 .header("accept", "application/json")
14                 .field("couponCode", "123")
15                 .asString();
16                 
17         System.out.println(jsonResponse.getBody());
18         
19         
20         
21         
22     }
23 }

http://unirest.io/java.html

http://pan.baidu.com/s/1kTWATN5

原文地址:https://www.cnblogs.com/huzi007/p/5048637.html