jcabi-http 是一个非常简单的 Java HTTP 客户端开发包。示例代码:
String html = new JdkRequest("https://www.oschina.net/") .uri().path("/users").queryParam("id", 333).back() .method(Request.GET) .header("Accept", "text/html") .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .body();
Maven:
<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-http</artifactId> <version>1.8.2</version> </dependency>