public class AbstractRESTClient extends Object implements ServiceStatus
| Modifier and Type | Field and Description |
|---|---|
protected static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
| Constructor and Description |
|---|
AbstractRESTClient(String uriProperty) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addHeaders(HttpURLConnection connection,
String tenantId)
Add the header values to the supplied connection.
|
void |
clear(String tenantId,
String path) |
String |
encodedCriteria(Criteria criteria) |
HttpURLConnection |
getConnectionForGetRequest(String tenantId,
URL url) |
HttpURLConnection |
getConnectionForRequest(String tenantId,
URL url,
String method) |
String |
getPassword() |
String |
getResponse(HttpURLConnection connection) |
<T> T |
getResultsForUrl(String tenantId,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference,
String path,
Criteria criteria) |
<T> T |
getResultsForUrl(String tenantId,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference,
String path,
Criteria criteria,
Object arg) |
<T> T |
getResultsForUrl(String tenantId,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference,
String path,
Object... parameters) |
String |
getUri() |
URL |
getUrl(String path) |
URL |
getUrl(String path,
Object... args) |
String |
getUsername() |
boolean |
isAvailable() |
<T> T |
parseResultsIntoJson(HttpURLConnection connection,
com.fasterxml.jackson.core.type.TypeReference<T> typeReference) |
int |
postAsJsonTo(String tenantId,
String path,
Object toSerialize) |
void |
setPassword(String password) |
void |
setUri(String uri) |
void |
setUsername(String username) |
<T> T |
withContext(String tenantId,
URL url,
Function<HttpURLConnection,T> function) |
<T> T |
withJsonPayloadAndResults(String method,
String tenantId,
URL url,
Object toSerialize,
Function<HttpURLConnection,T> function) |
public AbstractRESTClient(String uriProperty)
public boolean isAvailable()
isAvailable in interface ServiceStatuspublic String getUsername()
public void setUsername(String username)
username - the username to setpublic String getPassword()
public void setPassword(String password)
password - the password to setpublic String getUri()
public void setUri(String uri)
uri - the uri to setprotected void addHeaders(HttpURLConnection connection, String tenantId)
connection - The connectiontenantId - The optional tenant idpublic <T> T withContext(String tenantId, URL url, Function<HttpURLConnection,T> function)
public <T> T getResultsForUrl(String tenantId, com.fasterxml.jackson.core.type.TypeReference<T> typeReference, String path, Object... parameters)
public <T> T parseResultsIntoJson(HttpURLConnection connection, com.fasterxml.jackson.core.type.TypeReference<T> typeReference)
public <T> T getResultsForUrl(String tenantId, com.fasterxml.jackson.core.type.TypeReference<T> typeReference, String path, Criteria criteria)
public <T> T getResultsForUrl(String tenantId, com.fasterxml.jackson.core.type.TypeReference<T> typeReference, String path, Criteria criteria, Object arg)
public HttpURLConnection getConnectionForGetRequest(String tenantId, URL url) throws IOException
IOExceptionpublic HttpURLConnection getConnectionForRequest(String tenantId, URL url, String method) throws IOException
IOExceptionpublic String getResponse(HttpURLConnection connection) throws IOException
IOExceptionpublic <T> T withJsonPayloadAndResults(String method, String tenantId, URL url, Object toSerialize, Function<HttpURLConnection,T> function)
Copyright © 2015–2016 Red Hat, Inc.. All rights reserved.