public class JsonRestClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper |
| Constructor and Description |
|---|
JsonRestClient(JsonRestClientConfiguration cfg)
Creates the client and performs the client authentication.
|
JsonRestClient(JsonRestClientConfiguration cfg,
List<org.apache.http.Header> additionalHeaders)
Creates the client and performs the client authentication.
|
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.databind.JsonNode |
deleteRequest(String path)
Performs a HTTP DELETE request and returns the JSON response.
|
com.fasterxml.jackson.databind.JsonNode |
getJwtTokenInfo()
Returns decoded JWT token used by the client.
|
com.fasterxml.jackson.databind.JsonNode |
getRequest(String path)
Performs a HTTP GET request and returns the JSON response.
|
int |
getRequestWithOnlyResponseCode(String path)
Performs a HTTP GET request and returns the response code only.
|
com.fasterxml.jackson.databind.JsonNode |
postRequest(String path,
com.fasterxml.jackson.databind.JsonNode data)
Performs a HTTP POST request and returns the JSON response.
|
com.fasterxml.jackson.databind.JsonNode |
putRequest(String path,
com.fasterxml.jackson.databind.JsonNode data)
Performs a HTTP PUT request and returns the JSON response.
|
public JsonRestClient(JsonRestClientConfiguration cfg)
cfg - client configurationpublic JsonRestClient(JsonRestClientConfiguration cfg, List<org.apache.http.Header> additionalHeaders)
cfg - client configurationadditionalHeaders - additional request headers for the auth requestpublic com.fasterxml.jackson.databind.JsonNode getRequest(String path) throws IOException
path - destination URL pathIOException - in case of a problem or the connection was abortedJsonRestClientResponseException - in case when the response HTTP is not 2xxpublic int getRequestWithOnlyResponseCode(String path) throws IOException
path - destination URL pathIOException - in case of a problem or the connection was abortedpublic com.fasterxml.jackson.databind.JsonNode deleteRequest(String path) throws IOException
path - destination URL pathIOException - in case of a problem or the connection was abortedJsonRestClientResponseException - in case when the response HTTP is not 2xxpublic com.fasterxml.jackson.databind.JsonNode putRequest(String path, com.fasterxml.jackson.databind.JsonNode data) throws IOException
path - destination URL pathdata - JSON request bodyIOException - in case of a problem or the connection was abortedJsonRestClientResponseException - in case when the response HTTP is not 2xxpublic com.fasterxml.jackson.databind.JsonNode postRequest(String path, com.fasterxml.jackson.databind.JsonNode data) throws IOException
path - destination URL pathdata - JSON request bodyIOException - in case of a problem or the connection was abortedJsonRestClientResponseException - in case when the response HTTP is not 2xxpublic com.fasterxml.jackson.databind.JsonNode getJwtTokenInfo()
throws IOException
IOException - in case of a problem or the connection was abortedCopyright © 2021. All rights reserved.