Files
spring-soap/apache-httpclient/src/test/java/com/baeldung/httpclient/ResponseUtil.java
freelansam 2cc0b34f4f JAVA-10903: Rename HttpClient Modules to Apache HttpClient (#12070)
* JAVA-10903: rename httpclient to apache-httpclient

* JAVA-10903: rename httpclient-2 to apache-httpclient

* JAVA-10903: update main pom
2022-04-20 17:53:00 +05:30

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();
}
}
}