public interface HttpRequest
Modifier and Type | Method and Description |
---|---|
HttpRequest |
addQueryParam(java.lang.String key,
java.lang.String value)
Add a query parameter to the request.
|
HttpRequest |
basicAuthentication(java.lang.String clientId,
java.lang.String clientSecret)
Configure the request to perform basic access authentication.
|
HttpRequest |
bearerTokenAuthentication(java.lang.String value)
Configure the request to perform bearer token authentication.
|
HttpRequest |
putHeader(java.lang.String key,
java.lang.String value)
Configure the request to set a new HTTP header.
|
void |
send(AsyncResult result)
Send a request with empty body.
|
void |
sendJson(java.lang.String jsonObject,
AsyncResult result)
Send a Json string.
|
void |
sendJsonObject(java.lang.Object object,
AsyncResult result)
Send a Json object.
|
HttpRequest |
ssl(java.lang.Boolean ssl)
Configure ssl.
|
HttpRequest |
timeout(long timeout)
Configure the amount of time in milliseconds after which the request fails if no data is returned within the timeout.
|
HttpRequest putHeader(java.lang.String key, java.lang.String value)
key
- the header keyvalue
- the header valueHttpRequest basicAuthentication(java.lang.String clientId, java.lang.String clientSecret)
clientId
- the client IDclientSecret
- the client secretHttpRequest bearerTokenAuthentication(java.lang.String value)
value
- the bearer tokenHttpRequest ssl(java.lang.Boolean ssl)
ssl
- the ssl flagHttpRequest timeout(long timeout)
timeout
- the timeout in millisecondsHttpRequest addQueryParam(java.lang.String key, java.lang.String value)
key
- the param keyvalue
- the param valuevoid sendJsonObject(java.lang.Object object, AsyncResult result)
object
- the objectresult
- This parameter is about to be skipped in groovy scripts, it only indicates
the method is asynchronous. As for every asynchronous method, the script writers
can optionally pass a groovy.lang.Closure
as last argument that could
consume the asynchronous method result or simply be run after the asynchronous completion.
Closure postAction = {result, error -> ...}
void sendJson(java.lang.String jsonObject, AsyncResult result)
jsonObject
- the Json stringresult
- This parameter is about to be skipped in groovy scripts, it only indicates
the method is asynchronous. As for every asynchronous method, the script writers
can optionally pass a groovy.lang.Closure
as last argument that could
consume the asynchronous method result or simply be run after the asynchronous completion.
Closure postAction = {result, error -> ...}
void send(AsyncResult result)
result
- This parameter is about to be skipped in groovy scripts, it only indicates
the method is asynchronous. As for every asynchronous method, the script writers
can optionally pass a groovy.lang.Closure
as last argument that could
consume the asynchronous method result or simply be run after the asynchronous completion.
Closure postAction = {result, error -> ...}