public interface AsyncConnection
Asynchronous Connection for executing HTTP requests.
- Since:
- 1.0.18
- Author:
- Logicommerce
-
Method Summary
Modifier and TypeMethodDescriptionacceptType(String acceptType) Sets an accept type to the request.authorization(String authorization) Adds an authorization header to the request.contentType(String contentType) Sets a content type to the request.Assign cookiedelete()Sends a DELETE request.get()Sends a GET request.Adds a header to the request.Initializes the connection.Adds a path parameter to the request.Sends a PATCH request.Defines the path for the request.Sends a POST request.Sends a PUT request.queryParam(String name, String value) Adds a cookie to the request.timeout(int timeout) Defines the timeout in miliseconds for the request.
-
Method Details
-
init
Initializes the connection.- Parameters:
endPoint- aStringobject- Returns:
- a
Connectionobject
-
get
CompletableFuture<Response> get()Sends a GET request.- Returns:
- a
CompletableFuture<Response> object
-
post
Sends a POST request.- Parameters:
body- aStringobject- Returns:
- a
CompletableFuture<Response> object
-
put
Sends a PUT request.- Parameters:
body- aStringobject- Returns:
- a
CompletableFuture<Response> object
-
patch
Sends a PATCH request.- Parameters:
body- aStringobject- Returns:
- a
CompletableFuture<Response> object
-
delete
CompletableFuture<Response> delete()Sends a DELETE request.- Returns:
- a
CompletableFuture<Response> object
-
authorization
Adds an authorization header to the request.- Parameters:
authorization- aStringobject- Returns:
- a
Connectionobject
-
path
Defines the path for the request.- Parameters:
path- aStringobject- Returns:
- a
AsyncConnectionobject
-
contentType
Sets a content type to the request.- Parameters:
contentType- aStringobject- Returns:
- a
AsyncConnectionobject
-
acceptType
Sets an accept type to the request.- Parameters:
acceptType- aStringobject- Returns:
- a
AsyncConnectionobject
-
header
Adds a header to the request.- Parameters:
name- aStringobjectvalue- aStringobject- Returns:
- a
AsyncConnectionobject
-
cookie
Assign cookie- Parameters:
name- aStringobjectvalue- aStringobject- Returns:
- a
AsyncConnectionobject
-
queryParam
Adds a cookie to the request.- Parameters:
name- aStringobjectvalue- aStringobject- Returns:
- a
AsyncConnectionobject
-
params
Adds a path parameter to the request.- Parameters:
params- aStringobject- Returns:
- a
AsyncConnectionobject
-
timeout
Defines the timeout in miliseconds for the request. Default is 3000.- Parameters:
timeout- a int in miliseconds- Returns:
- a
AsyncConnectionobject
-