public class JsonRestClient extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JsonRestClient.OAuthToken |
Modifier and Type | Field and Description |
---|---|
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper |
Constructor and Description |
---|
JsonRestClient(JsonRestClientConfiguration cfg,
Map<String,Object> cedentials)
Creates the client
|
JsonRestClient(JsonRestClientConfiguration cfg,
Map<String,Object> cedentials,
int maxConnections,
int maxConnectionPerRoute)
Creates the client
|
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 |
postRequest(String path,
String data,
Map<String,String> headers)
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, Map<String,Object> cedentials)
cfg
- client configurationpublic JsonRestClient(JsonRestClientConfiguration cfg, Map<String,Object> cedentials, int maxConnections, int maxConnectionPerRoute)
cfg
- client configurationpublic 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 postRequest(String path, String data, Map<String,String> headers) throws IOException
path
- destination URL pathdata
- plain string request bodyheaders
- additional request headersIOException
- 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 © 2023. All rights reserved.