|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.orbitz.consul.util.ClientUtil
public class ClientUtil
A collection of stateless utility methods for use in constructing requests and responses to the Consul HTTP API.
| Constructor Summary | |
|---|---|
ClientUtil()
|
|
| Method Summary | ||
|---|---|---|
static java.lang.String |
decodeBase64(java.lang.String value)
Decodes a Base 64 encoded string. |
|
static javax.ws.rs.client.WebTarget |
eventConfig(javax.ws.rs.client.WebTarget webTarget,
EventOptions eventOptions)
Given a EventOptions object, adds the
appropriate query string parameters to the request being built. |
|
static void |
handleErrors(javax.ws.rs.core.Response response)
Since Consul returns plain text when an error occurs, check for unsuccessful HTTP status code, and throw an exception with the text from Consul as the message. |
|
static javax.ws.rs.client.WebTarget |
queryConfig(javax.ws.rs.client.WebTarget webTarget,
QueryOptions queryOptions)
Given a QueryOptions object, adds the
appropriate query string parameters to the request being built. |
|
static javax.ws.rs.client.WebTarget |
queryParams(javax.ws.rs.client.WebTarget webTarget,
java.util.Map<java.lang.String,java.lang.String> params)
Applies all key/values from the params map to query string parameters. |
|
static
|
response(javax.ws.rs.client.WebTarget target,
CatalogOptions catalogOptions,
QueryOptions queryOptions,
javax.ws.rs.core.GenericType<T> type)
Generates a ConsulResponse for a specific datacenter,
set of QueryOptions, and a result type. |
|
static
|
response(javax.ws.rs.client.WebTarget target,
CatalogOptions catalogOptions,
QueryOptions queryOptions,
javax.ws.rs.core.GenericType<T> type,
ConsulResponseCallback<T> callback)
Generates a ConsulResponse for a specific datacenter,
set of QueryOptions, and a result type. |
|
static
|
response(javax.ws.rs.client.WebTarget webTarget,
javax.ws.rs.core.GenericType<T> responseType)
Given a WebTarget object and a type to marshall
the result JSON into, complete the HTTP GET request. |
|
static
|
response(javax.ws.rs.client.WebTarget webTarget,
javax.ws.rs.core.GenericType<T> responseType,
ConsulResponseCallback<T> callback)
Given a WebTarget object and a type to marshall
the result JSON into, complete the HTTP GET request. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClientUtil()
| Method Detail |
|---|
public static javax.ws.rs.client.WebTarget queryParams(javax.ws.rs.client.WebTarget webTarget,
java.util.Map<java.lang.String,java.lang.String> params)
webTarget - The JAX-RS target to apply the query parameters.params - Map of parameters.
public static javax.ws.rs.client.WebTarget queryConfig(javax.ws.rs.client.WebTarget webTarget,
QueryOptions queryOptions)
QueryOptions object, adds the
appropriate query string parameters to the request being built.
webTarget - The base WebTarget.queryOptions - Query specific options to use.
WebTarget with all appropriate query
string parameters.
public static javax.ws.rs.client.WebTarget eventConfig(javax.ws.rs.client.WebTarget webTarget,
EventOptions eventOptions)
EventOptions object, adds the
appropriate query string parameters to the request being built.
webTarget - The base WebTarget.eventOptions - Event specific options to use.
WebTarget with all appropriate query
string parameters.
public static <T> ConsulResponse<T> response(javax.ws.rs.client.WebTarget target,
CatalogOptions catalogOptions,
QueryOptions queryOptions,
javax.ws.rs.core.GenericType<T> type)
ConsulResponse for a specific datacenter,
set of QueryOptions, and a result type.
T - The result type.target - The base WebTarget.catalogOptions - Catalog specific options to use.queryOptions - The Query Options to use.type - The generic type to marshall the resulting data to.
ConsulResponse.
public static <T> void response(javax.ws.rs.client.WebTarget target,
CatalogOptions catalogOptions,
QueryOptions queryOptions,
javax.ws.rs.core.GenericType<T> type,
ConsulResponseCallback<T> callback)
ConsulResponse for a specific datacenter,
set of QueryOptions, and a result type.
T - The result type.target - The base WebTarget.catalogOptions - Catalog specific options to use.queryOptions - The Query Options to use.type - The generic type to marshall the resulting data to.
public static <T> ConsulResponse<T> response(javax.ws.rs.client.WebTarget webTarget,
javax.ws.rs.core.GenericType<T> responseType)
WebTarget object and a type to marshall
the result JSON into, complete the HTTP GET request.
T - The class to marshall the JSON into.webTarget - The JAX-RS target.responseType - The class to marshall the JSON into.
ConsulResponse containing the result.
public static <T> void response(javax.ws.rs.client.WebTarget webTarget,
javax.ws.rs.core.GenericType<T> responseType,
ConsulResponseCallback<T> callback)
WebTarget object and a type to marshall
the result JSON into, complete the HTTP GET request.
T - The class to marshall the JSON into.webTarget - The JAX-RS target.responseType - The class to marshall the JSON into.callback - The callback object to handle the result on a different thread.public static java.lang.String decodeBase64(java.lang.String value)
value - The encoded string.
public static void handleErrors(javax.ws.rs.core.Response response)
response - The HTTP response.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||