public class RequestExecutor
extends java.lang.Object
Constructor and Description |
---|
RequestExecutor() |
Modifier and Type | Method and Description |
---|---|
static <T> com.google.common.util.concurrent.ListenableFuture<SphereResultRaw<T>> |
execute(RequestHolder<T> requestHolder,
org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
Executes request and parses JSON response as given type.
|
static <T> com.google.common.util.concurrent.ListenableFuture<com.google.common.base.Optional<T>> |
executeAndHandleError(RequestHolder<T> requestHolder,
int handledErrorStatus,
org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
Support for FetchRequest.
|
static <T> com.google.common.util.concurrent.ListenableFuture<T> |
executeAndThrowOnError(RequestHolder<T> requestHolder,
org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
Executes request and parses JSON response.
|
public static <T> com.google.common.util.concurrent.ListenableFuture<T> executeAndThrowOnError(RequestHolder<T> requestHolder, org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
SphereBackendException
on any response with status other than 2xx.
Use this method when sending requests to endpoints that are only expected to fail in conditions which shouldn't be handled by the application (such as programmer error, or 500 from Sphere), e.g. /product-projections/search.
public static <T> com.google.common.util.concurrent.ListenableFuture<com.google.common.base.Optional<T>> executeAndHandleError(RequestHolder<T> requestHolder, int handledErrorStatus, org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)
Optional.absent
if the backend responds with given status code.
Use this version when sending requests to endpoints where e.g. 404 Not Found is expected.
public static <T> com.google.common.util.concurrent.ListenableFuture<SphereResultRaw<T>> execute(RequestHolder<T> requestHolder, org.codehaus.jackson.type.TypeReference<T> jsonParserTypeRef)