Warning:
Fauna is decommissioning FQL v4 on June 30, 2025.
This driver is not compatible with FQL v10, the latest version. Fauna accounts created after August 21, 2024 must use FQL v10.
Ensure you migrate existing projects to the official v10 driver by the v4 EOL date: https://github.com/fauna/fauna-jvm.
For more information, see the v4 end of life (EOL) announcement and related FAQ.
public final class Connection extends Object implements AutoCloseable
Relies on async-http-client for the underlying implementation.
| Modifier and Type | Class and Description |
|---|---|
static class |
Connection.Builder
A builder for creating an instance of
Connection. |
| Modifier and Type | Method and Description |
|---|---|
static Connection.Builder |
builder()
Returns a new
Connection.Builder. |
void |
close()
Releases any resources being held by the HTTP client.
|
ListenableFuture<Response> |
get(String path)
Issues a
GET request with no parameters. |
ListenableFuture<Response> |
get(String path,
Map<String,List<String>> params)
Issues a
GET request with the provided request parameters. |
Connection |
newSessionConnection(String authToken)
Creates a new short live connection sharing its underneath
AsyncHttpClient. |
ListenableFuture<Response> |
patch(String path,
JsonNode body)
Issues a
PATCH request with the provided JSON request body. |
ListenableFuture<Response> |
post(String path,
JsonNode body)
Issues a
POST request with the provided JSON request body. |
ListenableFuture<Response> |
put(String path,
JsonNode body)
Issues a
PUT request with the provided JSON request body. |
public static Connection.Builder builder()
Connection.Builder.public Connection newSessionConnection(String authToken)
AsyncHttpClient. Queries submited to a
session connection will be authenticated with the token provided.authToken - token that will be used to authenticate requestsConnectionpublic void close()
AsyncHttpClient.close in interface AutoCloseablepublic ListenableFuture<Response> get(String path) throws IOException
GET request with no parameters.path - the relative path of the resource.ListenableFuture containing the HTTP Response.IOException - if the HTTP request cannot be issued.public ListenableFuture<Response> get(String path, Map<String,List<String>> params) throws IOException
GET request with the provided request parameters.path - the relative path of the resource.params - a map containing the request parameters.ListenableFuture containing the HTTP response.IOException - if the HTTP request cannot be issued.public ListenableFuture<Response> post(String path, JsonNode body) throws IOException
POST request with the provided JSON request body.path - the relative path of the resource.body - the JSON tree that will be serialized into the request body.ListenableFuture containing the HTTP response.IOException - if the HTTP request cannot be issued.public ListenableFuture<Response> put(String path, JsonNode body) throws IOException
PUT request with the provided JSON request body.path - the relative path of the resource.body - the JSON tree that will be serialized into the request body.ListenableFuture containing the HTTP response.IOException - if the HTTP request cannot be issued.public ListenableFuture<Response> patch(String path, JsonNode body) throws IOException
PATCH request with the provided JSON request body.path - the relative path of the resource.body - the JSON tree that will be serialized into the request body.ListenableFuture containing the HTTP response.IOException - if the HTTP request cannot be issued.