public class JerseyClientImpl extends Object implements JerseyClient
| Constructor and Description |
|---|
JerseyClientImpl(AuthenticationDetails auth)
Constructs a JerseyClientImpl instance, including an OAuth access token and refresh token.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPagingParams(javax.ws.rs.core.MultivaluedMap<String,String> queryString,
Integer page,
Integer pageSize,
String orderField,
String orderDirection) |
void |
delete(javax.ws.rs.core.MultivaluedMap<String,String> queryString,
String... pathElements)
Makes a HTTP DELETE request to the specified path with the specified query string
|
void |
delete(String... pathElements)
Makes a HTTP DELETE request to the specified path
|
protected <T> T |
fixStringResult(Class<T> klass,
T result)
Jersey is awesome in that even though we specify a JSON response and to use
the
JsonProvider it sees that we want a
String result and that the response is already a String so just use that. |
<T> T |
get(Class<T> klass,
ErrorDeserialiser<?> errorDeserialiser,
String... pathElements) |
<T> T |
get(Class<T> klass,
javax.ws.rs.core.MultivaluedMap<String,String> queryString,
ResourceFactory resourceFactory,
ErrorDeserialiser<?> errorDeserialiser,
String... pathElements) |
<T> T |
get(Class<T> klass,
javax.ws.rs.core.MultivaluedMap<String,String> queryString,
ResourceFactory resourceFactory,
String... pathElements) |
<T> T |
get(Class<T> klass,
javax.ws.rs.core.MultivaluedMap<String,String> queryString,
String... pathElements)
Performs a HTTP GET on the route specified by the pathElements deserialising the
result to an instance of klass.
|
<T> T |
get(Class<T> klass,
String... pathElements)
Performs a HTTP GET on the route specified by the pathElements deserialising the
result to an instance of klass.
|
AuthenticationDetails |
getAuthenticationDetails() |
static ParameterizedType |
getGenericReturnType(Class<?> klass,
int stackFrame) |
<T> PagedResult<T> |
getPagedResult(Integer page,
Integer pageSize,
String orderField,
String orderDirection,
javax.ws.rs.core.MultivaluedMap<String,String> queryString,
String... pathElements)
Performs a HTTP GET on the route specified attempting to deserialise the
result to a paged result of the given type.
|
<T> T |
post(Class<T> klass,
Object entity,
ErrorDeserialiser<?> errorDeserialiser,
String... pathElements) |
<T> T |
post(Class<T> klass,
Object entity,
javax.ws.rs.core.MediaType mediaType,
String... pathElements) |
<T> T |
post(Class<T> klass,
Object entity,
String... pathElements)
Posts the provided entity to the url specified by the provided path elements.
|
<T> T |
post(String baseUri,
Class<T> klass,
Object entity,
ErrorDeserialiser<?> errorDeserialiser,
javax.ws.rs.core.MediaType mediaType,
String... pathElements) |
<T> T |
post(String baseUri,
Class<T> klass,
Object entity,
ErrorDeserialiser<?> errorDeserialiser,
String... pathElements) |
<T> T |
post(String baseUri,
Class<T> klass,
Object entity,
javax.ws.rs.core.MediaType mediaType,
String... pathElements) |
<T> T |
post(String baseUri,
Class<T> klass,
Object entity,
String... pathElements) |
<T> T |
put(Class<T> klass,
Object entity,
String... pathElements) |
void |
put(Object entity,
ErrorDeserialiser<?> errorDeserialiser,
String... pathElements) |
void |
put(Object entity,
javax.ws.rs.core.MultivaluedMap<String,String> queryString,
String... pathElements) |
void |
put(Object entity,
String... pathElements)
Makes a HTTP PUT request to the path specified, using the provided entity as the
request body.
|
void |
setAuthenticationDetails(AuthenticationDetails authDetails) |
public JerseyClientImpl(AuthenticationDetails auth)
auth - public AuthenticationDetails getAuthenticationDetails()
getAuthenticationDetails in interface JerseyClientpublic void setAuthenticationDetails(AuthenticationDetails authDetails)
setAuthenticationDetails in interface JerseyClientpublic <T> T get(Class<T> klass, String... pathElements) throws CreateSendException
get in interface JerseyClientT - The type of model expected from the API call.klass - The class of the model to deserialise.pathElements - The path of the API resource to accessCreateSendException - If the API call results in a HTTP status code >= 400public <T> T get(Class<T> klass, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException
get in interface JerseyClientCreateSendExceptionpublic <T> T get(Class<T> klass, javax.ws.rs.core.MultivaluedMap<String,String> queryString, String... pathElements) throws CreateSendException
get in interface JerseyClientT - The type of model expected from the API call.klass - The class of the model to deserialise.queryString - The query string params to use for the request.
Use null when no query string is required.pathElements - The path of the API resource to accessCreateSendException - If the API call results in a HTTP status code >= 400public <T> T get(Class<T> klass, javax.ws.rs.core.MultivaluedMap<String,String> queryString, ResourceFactory resourceFactory, String... pathElements) throws CreateSendException
get in interface JerseyClientCreateSendExceptionpublic <T> T get(Class<T> klass, javax.ws.rs.core.MultivaluedMap<String,String> queryString, ResourceFactory resourceFactory, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException
CreateSendExceptionpublic <T> PagedResult<T> getPagedResult(Integer page, Integer pageSize, String orderField, String orderDirection, javax.ws.rs.core.MultivaluedMap<String,String> queryString, String... pathElements) throws CreateSendException
getPagedResult in interface JerseyClientT - The type of paged result data expected from the API call.queryString - The query string values to use for the request.pathElements - The path of the API resource to accessCreateSendException - If the API call results in a HTTP status code >= 400public <T> T post(Class<T> klass, Object entity, String... pathElements) throws CreateSendException
post in interface JerseyClientT - The class to use for model deserialisationklass - The class to use for model deserialisationentity - The entity to use as the body of the post requestpathElements - The path to send the post request toCreateSendException - Thrown when the API responds with a HTTP Status >= 400public <T> T post(Class<T> klass, Object entity, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException
post in interface JerseyClientCreateSendExceptionpublic <T> T post(String baseUri, Class<T> klass, Object entity, String... pathElements) throws CreateSendException
post in interface JerseyClientCreateSendExceptionpublic <T> T post(String baseUri, Class<T> klass, Object entity, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException
post in interface JerseyClientCreateSendExceptionpublic <T> T post(Class<T> klass, Object entity, javax.ws.rs.core.MediaType mediaType, String... pathElements) throws CreateSendException
post in interface JerseyClientCreateSendExceptionpublic <T> T post(String baseUri, Class<T> klass, Object entity, javax.ws.rs.core.MediaType mediaType, String... pathElements) throws CreateSendException
post in interface JerseyClientCreateSendExceptionpublic <T> T post(String baseUri, Class<T> klass, Object entity, ErrorDeserialiser<?> errorDeserialiser, javax.ws.rs.core.MediaType mediaType, String... pathElements) throws CreateSendException
post in interface JerseyClientCreateSendExceptionpublic void put(Object entity, String... pathElements) throws CreateSendException
put in interface JerseyCliententity - The entity to use as the request bodypathElements - The path to make the request to.CreateSendException - Raised when the API responds with a HTTP Status >= 400public <T> T put(Class<T> klass, Object entity, String... pathElements) throws CreateSendException
put in interface JerseyClientCreateSendExceptionpublic void put(Object entity, javax.ws.rs.core.MultivaluedMap<String,String> queryString, String... pathElements) throws CreateSendException
put in interface JerseyClientCreateSendExceptionpublic void put(Object entity, ErrorDeserialiser<?> errorDeserialiser, String... pathElements) throws CreateSendException
put in interface JerseyClientCreateSendExceptionpublic void delete(String... pathElements) throws CreateSendException
delete in interface JerseyClientpathElements - The path of the resource to deleteCreateSendException - Raised when the API responds with a HTTP Status >= 400public void delete(javax.ws.rs.core.MultivaluedMap<String,String> queryString, String... pathElements) throws CreateSendException
delete in interface JerseyClientpathElements - The path of the resource to deleteCreateSendException - Raised when the API responds with a HTTP Status >= 400protected void addPagingParams(javax.ws.rs.core.MultivaluedMap<String,String> queryString, Integer page, Integer pageSize, String orderField, String orderDirection)
protected <T> T fixStringResult(Class<T> klass, T result)
JsonProvider it sees that we want a
String result and that the response is already a String so just use that.
This method strips any enclosing quotes required as per the JSON spec.T - The type of result we are expectingklass - The class of the provided resultresult - The result as deserialised by Jerseypublic static ParameterizedType getGenericReturnType(Class<?> klass, int stackFrame)
Copyright © 2013. All Rights Reserved.