import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; public class HttpClientExample { public static void main(String[] args) throws Exception { HttpClient httpClient = new HttpClient(); httpClient.start(); Request request = httpClient.newRequest("http://example.com"); ContentResponse response = request.send(); System.out.println(response.getContentAsString()); httpClient.stop(); } }


上一篇:
下一篇:
切换中文