<dependency>
<groupId>com.github.lburgazzoli</groupId>
<artifactId>httpz</artifactId>
<version>1.2.0</version>
</dependency>
import java.io.IOException;
import com.github.lburgazzoli.httpz.*;
public class HttpClient {
public static void main(String[] args) throws IOException {
HttpResponse response = Httpz.newGet("http://example.com")
.execute();
int statusCode = response.getStatusCode();
String body = response.getBody();
System.out.println("Status Code: " + statusCode);
System.out.println("Response Body: " + body);
}
}
import java.io.IOException;
import com.github.lburgazzoli.httpz.*;
public class HttpClient {
public static void main(String[] args) throws IOException {
HttpResponse response = Httpz.newGet("http://example.com")
.queryParam("username", "john")
.header("Authorization", "Bearer token")
.execute();
int statusCode = response.getStatusCode();
String body = response.getBody();
System.out.println("Status Code: " + statusCode);
System.out.println("Response Body: " + body);
}
}
import java.io.IOException;
import com.github.lburgazzoli.httpz.*;
public class HttpClient {
public static void main(String[] args) throws IOException {
HttpResponse response = Httpz.newGet("http://example.com")
.execute();
for (String header : response.getHeaders()) {
System.out.println(header);
}
}
}