Class ApacheHC5HttpClientResponse
java.lang.Object
org.eclipse.rdf4j.http.client.apache5.ApacheHC5HttpClientResponse
- All Implemented Interfaces:
AutoCloseable, HttpResponse
HttpResponse backed by an Apache HC5 ClassicHttpResponse.
Closing this response returns the connection to the pool.
-
Constructor Summary
ConstructorsConstructorDescriptionApacheHC5HttpClientResponse(org.apache.hc.core5.http.ClassicHttpResponse response) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this response, releasing any underlying connection or stream resources.voiddiscard()Discards the response body, releasing any underlying resources.Returns anInputStreamover the response body.intMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HttpResponse
discardAndClose, discardQuietly, getHeader, getHeadersModifier and TypeMethodDescriptiondefault voidDiscards the response body and closes this response, releasing the underlying connection.default voidDiscards the response body, silently ignoring anyIOException.Returns the first header value for the given name (case-insensitive).default List<HttpHeader> getHeaders(String name) Returns all headers matching the given name (case-insensitive).
-
Constructor Details
-
ApacheHC5HttpClientResponse
public ApacheHC5HttpClientResponse(org.apache.hc.core5.http.ClassicHttpResponse response)
-
-
Method Details
-
getStatusCode
public int getStatusCode()- Specified by:
getStatusCodein interfaceHttpResponse- Returns:
- the HTTP status code.
-
getReasonPhrase
- Specified by:
getReasonPhrasein interfaceHttpResponse- Returns:
- the HTTP reason phrase, or an empty string if not available.
-
getHeaders
- Specified by:
getHeadersin interfaceHttpResponse- Returns:
- all response headers.
-
getBodyAsStream
Description copied from interface:HttpResponseReturns anInputStreamover the response body. For responses with no body (e.g. HTTP 204 No Content, or responses to HEAD requests), implementations must return an empty stream rather thannull.- Specified by:
getBodyAsStreamin interfaceHttpResponse- Returns:
- an
InputStreamover the response body; nevernull - Throws:
IOException- if reading fails.
-
discard
Description copied from interface:HttpResponseDiscards the response body, releasing any underlying resources.- Specified by:
discardin interfaceHttpResponse- Throws:
IOException- if discarding fails.
-
close
public void close()Description copied from interface:HttpResponseCloses this response, releasing any underlying connection or stream resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceHttpResponse
-