public abstract class AbstractApiHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static com.fasterxml.jackson.databind.ObjectMapper |
mapper
object mapper for JSON (de)serialization
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractApiHandler(String cloudconductorUrl) |
protected |
AbstractApiHandler(String cloudconductorUrl,
String username,
String password) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_delete(String path) |
protected <T> T |
_get(String path,
Class<T> type) |
protected Object |
_get(String path,
com.fasterxml.jackson.databind.JavaType type) |
protected org.apache.http.HttpResponse |
_post(String path,
Object post) |
protected <T> T |
_post(String path,
Object post,
Class<T> type) |
protected <T> T |
_post(String path,
Object post,
com.fasterxml.jackson.databind.JavaType type) |
protected org.apache.http.HttpResponse |
_put(String path) |
protected org.apache.http.HttpResponse |
_put(String path,
Object put) |
protected <T> T |
_put(String path,
Object put,
Class<T> type) |
protected <T> T |
_put(String path,
Object put,
com.fasterxml.jackson.databind.JavaType type) |
protected static void |
assertSuccess(String path,
org.apache.http.HttpResponse response) |
protected String |
dataFromResponse(org.apache.http.HttpResponse response)
Returns the plain text data returned in the given response.
|
protected com.fasterxml.jackson.databind.JavaType |
getSetType(Class<?> clazz) |
protected <T> T |
objectFromResponse(org.apache.http.HttpResponse response,
Class<T> type)
Creates an object from the given HTTP response.
|
protected <T> T |
objectFromResponse(org.apache.http.HttpResponse response,
com.fasterxml.jackson.databind.JavaType type)
Creates an object from the given HTTP response.
|
protected String |
pathGenerator(String path,
String... replace) |
protected de.taimos.httputils.HTTPRequest |
request(String path)
Creates HTTP request for the given path.
|
protected de.taimos.httputils.HTTPRequest |
request(String path,
Object obj)
Creates HTTP request for the given path with the given object as the body.
|
protected de.taimos.httputils.HTTPRequest |
request(String path,
Object obj,
com.fasterxml.jackson.databind.JavaType type) |
public static final com.fasterxml.jackson.databind.ObjectMapper mapper
protected AbstractApiHandler(String cloudconductorUrl)
protected final Object _get(String path, com.fasterxml.jackson.databind.JavaType type) throws CloudConductorException
CloudConductorExceptionprotected final <T> T _get(String path, Class<T> type) throws CloudConductorException
CloudConductorExceptionprotected final org.apache.http.HttpResponse _put(String path) throws CloudConductorException
CloudConductorExceptionprotected final org.apache.http.HttpResponse _put(String path, Object put) throws CloudConductorException
CloudConductorExceptionprotected final <T> T _put(String path, Object put, com.fasterxml.jackson.databind.JavaType type) throws CloudConductorException
CloudConductorExceptionprotected final <T> T _put(String path, Object put, Class<T> type) throws CloudConductorException
CloudConductorExceptionprotected final org.apache.http.HttpResponse _post(String path, Object post) throws CloudConductorException
CloudConductorExceptionprotected final <T> T _post(String path, Object post, com.fasterxml.jackson.databind.JavaType type) throws CloudConductorException
CloudConductorExceptionprotected final <T> T _post(String path, Object post, Class<T> type) throws CloudConductorException
CloudConductorExceptionprotected final void _delete(String path) throws CloudConductorException
CloudConductorExceptionprotected final <T> T objectFromResponse(org.apache.http.HttpResponse response,
Class<T> type)
throws SerializationException
response - the HTTP responsetype - the expected Java type of the objectSerializationException - if the mapping was unsuccessfulprotected final <T> T objectFromResponse(org.apache.http.HttpResponse response,
com.fasterxml.jackson.databind.JavaType type)
throws SerializationException
response - the HTTP responsetype - the expected Java type of the objectSerializationException - if the mapping was unsuccessfulprotected final String dataFromResponse(org.apache.http.HttpResponse response)
response - the HTTP responseprotected final de.taimos.httputils.HTTPRequest request(String path)
path - the path to the resourceprotected final de.taimos.httputils.HTTPRequest request(String path, Object obj) throws SerializationException
path - the path to the resourceobj - the objectSerializationException - if the object could not be mapped to a JSON stringprotected final de.taimos.httputils.HTTPRequest request(String path, Object obj, com.fasterxml.jackson.databind.JavaType type) throws SerializationException
SerializationExceptionprotected static final void assertSuccess(String path, org.apache.http.HttpResponse response) throws ClientErrorException, ServerErrorException
protected final com.fasterxml.jackson.databind.JavaType getSetType(Class<?> clazz)
Copyright © 2013-2014 Cinovo AG. All Rights Reserved.