Skip to content
This repository was archived by the owner on Oct 20, 2020. It is now read-only.

Latest commit

 

History

History
24 lines (16 loc) · 709 Bytes

sync-get.md

File metadata and controls

24 lines (16 loc) · 709 Bytes

AsyncHttpClient Example GET

Example GET

	SyncHttpClient<JsonElement> client = new SyncHttpClient<JsonElement>("http://example.com");
	JsonElement response = client.get("api/v1/", new JsonResponseHandler());

Example GET with parameters and headers

	SyncHttpClient<JsonElement> client = new SyncHttpClient<JsonElement>("http://example.com");

	List<NameValuePair> params = new ArrayList<>();
	params.add(new NameValuePair("key", "value"));

	Headers headers = Headers.of("Header", "value");

	JsonElement response = client.get("api/v1/", params, headers, new JsonResponseHandler());

	// Get the connection info
	ConnectionInfo connectionInfo = client.getConnectionInfo();