Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

APACHE HTTPCOMPONENTS / CATATAN</>
Apache HttpComponents11 Jan 2017

How do I do multipart upload using HttpClient?

This example demonstrates how to do multipart upload using the Apache HttpClient library. In this example we upload a single file. We start by creating an object of the file to be uploaded. The FileBody represent the binary body part of the file. Next, prepare the HttpEntity object by create an instance of MultipartEntityBuilder. Add […]

Wayan · 3 menit baca
APACHE HTTPCOMPONENTS / CATATAN</>
Apache HttpComponents06 Jan 2017

How do I send POST request with a JSON body using the HttpClient?

The following code snippet show you how to send POST request with a JSON body using HttpClient. The payload in this example is a user information containing id, first_name and a last_name. We placed the payload in an object called StringEntity and also set its content type to ContentType.APPLICATION_FORM_URLENCODED. On the other end called by […]

Wayan · 2 menit baca
APACHE HTTPCOMPONENTS / CATATAN</>
Apache HttpComponents27 Nov 2012

How do I send an HTTP POST request?

The following code snippet will show you how to send an HTTP post request using the Apache HttpComponents. We will send a post request to https://httpbin.org/post, with some parameters to the request using the NameValuePair object. To pass these parameters to the HTTP post request we create an instance of UrlEncodedFormEntity and pass a list […]

Wayan · 2 menit baca
APACHE HTTPCOMPONENTS / CATATAN</>
Apache HttpComponents26 Nov 2012

How do I get HTTP response body as a string?

This example show you how to get HTTP response body as a string when using the Apache HttpComponents library. To get the response body as a string we can use the EntityUtils.toString() method. This method read the content of an HttpEntity object content and return it as a string. The content will be converted using […]

Wayan · 2 menit baca
APACHE HTTPCOMPONENTS / CATATAN</>
Apache HttpComponents26 Nov 2012

How do I get entity ContentType in HttpClient?

This code snippet show you how to get the content-type of an HTTP Get request. The ContentType can be obtained by using ContentType.getOrDefault() method and passing an HttpEntity as the argument. The HttpEntity can be obtained from the HttpResponse object. From the ContentType object we can get the mime-type by calling the getMimeType() method. This […]

Wayan · 2 menit baca
APACHE HTTPCOMPONENTS / CATATAN</>
Apache HttpComponents26 Nov 2012

How do I execute HTTP Get request?

Below is an example using HttpClient library to retrieve the response of HTTP GET request. We start by creating an instance of CloseableHttpClient class. We then define an HTTP GET request by create an instance of HttpGet class and specify the Url of a website we are going to retrieve. To execute the request we […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.