public class Connection
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Response |
get(Request request)
Sends the request with method GET.
|
static java.util.function.Function<java.net.URL,Connection> |
getConnectionFactory()
Returns a factory for
Connection. |
static java.util.function.Function<java.net.URL,Connection> |
getInsecureConnectionFactory()
Returns a factory for
Connection that does not verify TLS peer verification. |
Response |
post(Request request)
Sends the request with method POST.
|
Response |
put(Request request)
Sends the request with method PUT.
|
Response |
send(java.lang.String httpMethod,
Request request)
Sends the request.
|
public static java.util.function.Function<java.net.URL,Connection> getConnectionFactory()
Connection.Connection factory, a function that generates a Connection to a URLpublic static java.util.function.Function<java.net.URL,Connection> getInsecureConnectionFactory() throws java.security.GeneralSecurityException
Connection that does not verify TLS peer verification.Connection factory, a function that generates a Connection to a URLjava.security.GeneralSecurityException - if unable to turn off TLS peer verificationpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic Response get(Request request) throws java.io.IOException
request - the request to sendjava.io.IOException - if sending the request failspublic Response post(Request request) throws java.io.IOException
request - the request to sendjava.io.IOException - if sending the request failspublic Response put(Request request) throws java.io.IOException
request - the request to sendjava.io.IOException - if sending the request failspublic Response send(java.lang.String httpMethod, Request request) throws java.io.IOException
httpMethod - the HTTP request methodrequest - the request to sendjava.io.IOException - if building the HTTP request fails.