Interface RDF4JHttpClient
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
ApacheHC5RDF4JHttpClient, JdkRDF4JHttpClient
Implementations wrap a concrete HTTP client library (e.g., JDK java.net.http.HttpClient or Apache
HttpComponents 5). The caller is responsible for closing the returned HttpResponse.
Implementations may support transparent retry behavior. For example, a connection-pool-backed implementation may retry a request once when a stale pooled connection is detected (i.e., the server has closed the connection while it was idle), and may additionally retry on HTTP 408 (Request Timeout) responses up to a limit derived from the pool size. Redirect following (including preserving the original HTTP method across 301/302/307/308 responses) is also handled transparently by capable implementations.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this client and releases any resources held (e.g., connection pools, threads).execute(HttpRequest request) Executes the given HTTP request and returns the response.
-
Method Details
-
execute
Executes the given HTTP request and returns the response.The caller must close the returned
HttpResponseafter use to release connection resources.- Parameters:
request- the request to execute.- Returns:
- the HTTP response.
- Throws:
IOException- if a network or I/O error occurs.
-
close
void close()Closes this client and releases any resources held (e.g., connection pools, threads).- Specified by:
closein interfaceAutoCloseable
-