Class JdkHttpClient
- java.lang.Object
-
- com.github.nosan.embedded.cassandra.commons.web.JdkHttpClient
-
- All Implemented Interfaces:
HttpClient
public class JdkHttpClient extends Object implements HttpClient
HttpURLConnectionbased implementation ofHttpClient.- Since:
- 4.0.0
- Author:
- Dmytro Nosan
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.nosan.embedded.cassandra.commons.web.HttpClient
HttpClient.BodySuppliers
-
-
Constructor Summary
Constructors Constructor Description JdkHttpClient()CreatesJdkHttpClientwith no timeouts and proxy.JdkHttpClient(Proxy proxy)CreatesJdkHttpClientwith no timeouts and provided proxy.JdkHttpClient(Duration connectTimeout, Duration readTimeout)CreatesJdkHttpClientwith provided timeouts and no proxy.JdkHttpClient(Duration connectTimeout, Duration readTimeout, Proxy proxy)CreatesJdkHttpClientwith provided timeouts and proxy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpResponsesend(HttpRequest httpRequest, IOSupplier<? extends InputStream> bodySupplier)Sends HTTP request with a provided body.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.nosan.embedded.cassandra.commons.web.HttpClient
send
-
-
-
-
Constructor Detail
-
JdkHttpClient
public JdkHttpClient()
CreatesJdkHttpClientwith no timeouts and proxy.
-
JdkHttpClient
public JdkHttpClient(Proxy proxy)
CreatesJdkHttpClientwith no timeouts and provided proxy.- Parameters:
proxy- proxy to use
-
JdkHttpClient
public JdkHttpClient(Duration connectTimeout, Duration readTimeout)
CreatesJdkHttpClientwith provided timeouts and no proxy.- Parameters:
connectTimeout- connection timeoutreadTimeout- read timeout
-
JdkHttpClient
public JdkHttpClient(Duration connectTimeout, Duration readTimeout, Proxy proxy)
CreatesJdkHttpClientwith provided timeouts and proxy.- Parameters:
connectTimeout- connection timeoutreadTimeout- read timeoutproxy- proxy to use
-
-
Method Detail
-
send
public final HttpResponse send(HttpRequest httpRequest, IOSupplier<? extends InputStream> bodySupplier) throws IOException
Description copied from interface:HttpClientSends HTTP request with a provided body.- Specified by:
sendin interfaceHttpClient- Parameters:
httpRequest- the request to be sentbodySupplier- HTTP body to be sent- Returns:
- HTTP response
- Throws:
IOException- an I/O error occurs- See Also:
HttpClient.BodySuppliers
-
-