메이븐 의존성
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.2</version>
</dependency>
코드 스니펫
HttpPost httpPost = new HttpPost("http://URL/");
httpPost.addHeader("Cookie", request.getHeader("Cookie"));
List<NameValuePair> nameValuePairs = new ArrayList<>();
nameValuePairs.add(new BasicNameValuePair("playlist", playlist));
nameValuePairs.add(new BasicNameValuePair("shuffle", shuffle));
nameValuePairs.add(new BasicNameValuePair("repeatMode", repeatMode));
nameValuePairs.add(new BasicNameValuePair("sortType", sortType));
nameValuePairs.add(new BasicNameValuePair("position", position));
nameValuePairs.add(new BasicNameValuePair("playTime", playTime));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, Consts.UTF_8));
HttpClient httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(httpPost);
String body = EntityUtils.toString(response.getEntity());
관련