简便的Java Http请求处理类库:Http Request

jopen 9年前

一个简单方便的使用HttpURLConnection类的库发出请求和访问响应。

Perform a GET request and get the status of the response

int response = HttpRequest.get("http://google.com").code(); 

Perform a GET request and get the body of the response

String response = HttpRequest.get("http://google.com").body();  System.out.println("Response was: " + response); 

Print the response of a GET request to standard out

HttpRequest.get("http://google.com").receive(System.out); 

项目主页:http://www.open-open.com/lib/view/home/1371654436187