* [JAVA-15035] Created module httpclient4 and moved related code * [JAVA-15035] Upgraded httpclient-simple to spring-boot-e * [JAVA-15035] Moved modules to to right profiles * [JAVA-15026] Upgraded headers code to apache 5.2 + moved code related to 4.5 to httpclient4 module * [JAVA-14911] Final clean up for http-client module --------- Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
27 lines
618 B
Java
27 lines
618 B
Java
package com.baeldung.httpclient;
|
|
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
|
import java.io.IOException;
|
|
|
|
public final class ResponseUtil {
|
|
private ResponseUtil() {
|
|
}
|
|
|
|
public static void closeResponse(CloseableHttpResponse response) throws IOException {
|
|
if (response == null) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
final HttpEntity entity = response.getEntity();
|
|
if (entity != null) {
|
|
entity.getContent().close();
|
|
}
|
|
} finally {
|
|
response.close();
|
|
}
|
|
}
|
|
}
|