public abstract class EurekaClinicalClient extends Object implements AutoCloseable
| Modifier | Constructor and Description |
|---|---|
protected |
EurekaClinicalClient(Class<? extends javax.ws.rs.ext.ContextResolver<? extends org.codehaus.jackson.map.ObjectMapper>> cls)
Constructor for passing in the object mapper instance that is used for
converting from/to JSON.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
doDelete(String path)
Deletes the resource specified by the path.
|
protected void |
doDelete(String path,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Deletes the resource specified by the path.
|
protected com.sun.jersey.api.client.ClientResponse |
doDeleteForProxy(String path,
javax.ws.rs.core.MultivaluedMap<String,String> parameterMap,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Deletes a resource from a proxied server.
|
protected <T> T |
doGet(String path,
Class<T> cls)
Gets the resource specified by the path.
|
protected <T> T |
doGet(String path,
Class<T> cls,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Gets the resource specified by the path.
|
protected <T> T |
doGet(String path,
com.sun.jersey.api.client.GenericType<T> genericType)
Gets the requested resource.
|
protected <T> T |
doGet(String path,
com.sun.jersey.api.client.GenericType<T> genericType,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Gets the requested resource
|
protected <T> T |
doGet(String path,
javax.ws.rs.core.MultivaluedMap<String,String> queryParams,
Class<T> cls)
Gets the resource specified by the path and the provided query
parameters.
|
protected <T> T |
doGet(String path,
javax.ws.rs.core.MultivaluedMap<String,String> queryParams,
Class<T> cls,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Gets the resource specified by the path and the provided query
parameters.
|
protected <T> T |
doGet(String path,
javax.ws.rs.core.MultivaluedMap<String,String> queryParams,
com.sun.jersey.api.client.GenericType<T> genericType)
Gets the requested resource.
|
protected <T> T |
doGet(String path,
javax.ws.rs.core.MultivaluedMap<String,String> queryParams,
com.sun.jersey.api.client.GenericType<T> genericType,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Gets the requested resource
|
protected com.sun.jersey.api.client.ClientResponse |
doGetForProxy(String path,
javax.ws.rs.core.MultivaluedMap<String,String> parameterMap,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Gets a resource from a proxied server.
|
protected com.sun.jersey.api.client.ClientResponse |
doGetResponse(String path)
Makes the GET call and returns the response.
|
protected com.sun.jersey.api.client.ClientResponse |
doGetResponse(String path,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Makes the GET call with the provided headers and returns the response.
|
protected void |
doPost(String path)
Makes a POST call to the specified path.
|
protected <T> T |
doPost(String path,
javax.ws.rs.core.MultivaluedMap<String,String> formParams,
Class<T> cls)
Submits a form and gets back a JSON object.
|
protected <T> T |
doPost(String path,
javax.ws.rs.core.MultivaluedMap<String,String> formParams,
Class<T> cls,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Submits a form and gets back a JSON object.
|
protected <T> T |
doPost(String path,
javax.ws.rs.core.MultivaluedMap<String,String> formParams,
com.sun.jersey.api.client.GenericType<T> genericType)
Submits a form and gets back a JSON object.
|
protected <T> T |
doPost(String path,
javax.ws.rs.core.MultivaluedMap<String,String> formParams,
com.sun.jersey.api.client.GenericType<T> genericType,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Submits a form and gets back a JSON object.
|
protected void |
doPost(String path,
Object o)
Makes a POST request with the provided object in the body as JSON.
|
protected void |
doPost(String path,
Object o,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Makes a POST request with the provided object in the body as JSON.
|
protected URI |
doPostCreate(String path,
Object o)
Creates a resource specified as a JSON object.
|
protected URI |
doPostCreate(String path,
Object o,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Creates a resource specified as a JSON object.
|
protected URI |
doPostCreateMultipart(String path,
com.sun.jersey.multipart.FormDataMultiPart formDataMultiPart)
Creates a resource specified as a multi-part form.
|
protected URI |
doPostCreateMultipart(String path,
InputStream inputStream)
Creates a resource specified as a multi-part form in an input stream.
|
protected URI |
doPostCreateMultipart(String path,
InputStream inputStream,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Creates a resource specified as a multi-part form in an input stream.
|
protected void |
doPostForm(String path,
javax.ws.rs.core.MultivaluedMap<String,String> formParams)
Submits a form.
|
protected void |
doPostForm(String path,
javax.ws.rs.core.MultivaluedMap<String,String> formParams,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Submits a form.
|
protected com.sun.jersey.api.client.ClientResponse |
doPostForProxy(String path,
InputStream inputStream,
javax.ws.rs.core.MultivaluedMap<String,String> parameterMap,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Passes a new resource, form or other POST body to a proxied server.
|
protected com.sun.jersey.api.client.ClientResponse |
doPostForProxy(String path,
String body,
javax.ws.rs.core.MultivaluedMap<String,String> parameterMap,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Passes a new resource, form or other POST body to a proxied server.
|
void |
doPostMultipart(String path,
com.sun.jersey.multipart.FormDataMultiPart formDataMultiPart)
Submits a multi-part form.
|
void |
doPostMultipart(String path,
com.sun.jersey.multipart.FormDataMultiPart formDataMultiPart,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Submits a multi-part form.
|
protected void |
doPostMultipart(String path,
InputStream inputStream)
Submits a multi-part form in an input stream.
|
protected void |
doPostMultipart(String path,
InputStream inputStream,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Submits a multi-part form in an input stream.
|
protected void |
doPut(String path)
Updates the resource specified by the path, for situations where the
nature of the update is completely specified by the path alone.
|
protected void |
doPut(String path,
Object o)
Updates the resource specified by the path.
|
protected void |
doPut(String path,
Object o,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Updates the resource specified by the path.
|
protected com.sun.jersey.api.client.ClientResponse |
doPutForProxy(String path,
InputStream inputStream,
javax.ws.rs.core.MultivaluedMap<String,String> parameterMap,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Passes a resource update to a proxied server.
|
protected com.sun.jersey.api.client.ClientResponse |
doPutForProxy(String path,
String contents,
javax.ws.rs.core.MultivaluedMap<String,String> parameterMap,
javax.ws.rs.core.MultivaluedMap<String,String> headers)
Passes a resource update to a proxied server.
|
protected void |
errorIfStatusEqualTo(com.sun.jersey.api.client.ClientResponse response,
com.sun.jersey.api.client.ClientResponse.Status... status)
If there is an unexpected status code, this method gets the status
message, closes the response, and throws an exception.
|
protected void |
errorIfStatusNotEqualTo(com.sun.jersey.api.client.ClientResponse response,
com.sun.jersey.api.client.ClientResponse.Status... status)
If there is an unexpected status code, it gets the status message, closes
the response, and throws an exception.
|
protected Long |
extractId(URI uri)
Extracts the id of the resource specified in the response body from a
POST call.
|
protected abstract URI |
getResourceUrl() |
protected EurekaClinicalClient(Class<? extends javax.ws.rs.ext.ContextResolver<? extends org.codehaus.jackson.map.ObjectMapper>> cls)
cls - the class of the object mapper.public void close()
close in interface AutoCloseableprotected abstract URI getResourceUrl()
protected void doDelete(String path) throws ClientException
path - the path to the resource. Cannot be null.ClientException - if a status code other than 204 (No Content), 202
(Accepted), and 200 (OK) is returned.protected void doDelete(String path, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
headers - any HTTP headers. Can be null.path - the path to the resource. Cannot be null.ClientException - if a status code other than 204 (No Content), 202
(Accepted), and 200 (OK) is returned.protected void doPut(String path) throws ClientException
path - the path to the resource. Cannot be null.ClientException - if a status code other than 204 (No Content) and
200 (OK) is returned.protected void doPut(String path, Object o) throws ClientException
o - the updated object, will be transmitted as JSON. It must be a
Java bean or an object that the object mapper that is in use knows about.path - the path to the resource. Cannot be null.ClientException - if a status code other than 204 (No Content) or
200 (OK) is returned.protected void doPut(String path, Object o, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
o - the updated object, will be transmitted as JSON. It must be a
Java bean or an object that the object mapper that is in use knows about.path - the path to the resource. Cannot be null.headers - any headers to pass along. Can be null. If
there is no content type header in the provided headers, this method will
add a Content Type header for JSON.ClientException - if a status code other than 204 (No Content) or
200 (OK) is returned.protected <T> T doGet(String path, Class<T> cls) throws ClientException
T - the type of the resource.path - the path to the resource. Cannot be null.cls - the type of the resource. Cannot be null.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, Class<T> cls, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
T - the type of the resource.path - the path to the resource. Cannot be null.cls - the type of the resource. Cannot be null.headers - any headers. if no Accepts header is provided, an Accepts
header for JSON will be added.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Class<T> cls) throws ClientException
T - the type of the resource.path - the path to the resource.queryParams - any query parameters. Cannot be null.cls - the type of the resource. Cannot be null.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, Class<T> cls, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
T - the type of the resource.path - the path to the resource.queryParams - any query parameters. Cannot be null.cls - the type of the resource. Cannot be null.headers - any headers. If no Accepts header is provided, an Accepts
header for JSON will be added.ClientException - if a status code other than 200 (OK) is returned.protected com.sun.jersey.api.client.ClientResponse doGetResponse(String path) throws ClientException
getEntity method is called. Sends to
the server an Accepts header for JSON.path - the path to call. Cannot be null.ClientException - if a status code other than 200 (OK) is returned.protected com.sun.jersey.api.client.ClientResponse doGetResponse(String path, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
getEntity
method is called.path - the path to call. Cannot be null.headers - any headers. If no Accepts header is provided, this method
will add an Accepts header for JSON.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, com.sun.jersey.api.client.GenericType<T> genericType) throws ClientException
T - the type of the requested resource.path - the path to the resource.genericType - the type of the requested resource.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, com.sun.jersey.api.client.GenericType<T> genericType, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
T - the type of the requested resource.path - the path to the resource.genericType - the type of the requested resource.headers - any headers. If no Accepts header is provided, it adds an
Accepts header for JSON.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, com.sun.jersey.api.client.GenericType<T> genericType) throws ClientException
T - the type of the requested resource.path - the path to the resource.queryParams - any query parameters to send.genericType - the type of the requested resource.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doGet(String path, javax.ws.rs.core.MultivaluedMap<String,String> queryParams, com.sun.jersey.api.client.GenericType<T> genericType, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
T - the type of the requested resource.path - the path to the resource.queryParams - any query parameters to send.genericType - the type of the requested resource.headers - any headers. If no Accepts header is provided, it adds an
Accepts header for JSON.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doPost(String path, javax.ws.rs.core.MultivaluedMap<String,String> formParams, Class<T> cls) throws ClientException
T - the type of object that is expected in the response.path - the API to call.formParams - the form parameters to send.cls - the type of object that is expected in the response.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doPost(String path, javax.ws.rs.core.MultivaluedMap<String,String> formParams, Class<T> cls, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
T - the type of the object that is expected in the response.path - the API to call.formParams - the form parameters to send.cls - the type of object that is expected in the response.headers - any headers. If there is no Accepts header, an Accepts
header is added for JSON. If there is no Content Type header, a Content
Type header is added for forms.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doPost(String path, javax.ws.rs.core.MultivaluedMap<String,String> formParams, com.sun.jersey.api.client.GenericType<T> genericType) throws ClientException
T - the type of object that is expected in the response.path - the API to call.formParams - the form parameters to send.genericType - the type of object that is expected in the response.ClientException - if a status code other than 200 (OK) is returned.protected <T> T doPost(String path, javax.ws.rs.core.MultivaluedMap<String,String> formParams, com.sun.jersey.api.client.GenericType<T> genericType, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
T - the type of the object that is expected in the response.path - the API to call.formParams - the form parameters to send.genericType - the type of object that is expected in the response.headers - any headers. If there is no Accepts header, an Accepts
header is added for JSON. If there is no Content Type header, a Content
Type header is added for forms.ClientException - if a status code other than 200 (OK) is returned.protected void doPost(String path) throws ClientException
path - the path to call.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected void doPostForm(String path, javax.ws.rs.core.MultivaluedMap<String,String> formParams) throws ClientException
path - the API to call.formParams - the form parameters to send.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected void doPostForm(String path, javax.ws.rs.core.MultivaluedMap<String,String> formParams, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the API to call.formParams - the multi-part form content.headers - any headers to send. If no Content Type header is
specified, it adds a Content Type for form data.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected void doPost(String path, Object o) throws ClientException
path - the API to call.o - the object to send.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected void doPost(String path, Object o, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the API to call.o - the object to send.headers - any headers. If no Content Type header is provided, this
method adds a Content Type header for JSON.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.public void doPostMultipart(String path, com.sun.jersey.multipart.FormDataMultiPart formDataMultiPart) throws ClientException
path - the API to call.formDataMultiPart - the multi-part form content.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.public void doPostMultipart(String path, com.sun.jersey.multipart.FormDataMultiPart formDataMultiPart, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the API to call.formDataMultiPart - the multi-part form content.headers - any headers to add. If no Content Type header is provided,
this method adds a Content Type header for multi-part forms data.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected void doPostMultipart(String path, InputStream inputStream) throws ClientException
path - the the API to call.inputStream - the multi-part form content.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected void doPostMultipart(String path, InputStream inputStream, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the the API to call.inputStream - the multi-part form content.headers - the headers to send. If no Accepts header is provided,
this method as an Accepts header for text/plain. If no Content Type
header is provided, this method adds a Content Type header for multi-part
forms data.ClientException - if a status code other than 200 (OK) and 204 (No
Content) is returned.protected URI doPostCreate(String path, Object o) throws ClientException
path - the the API to call.o - the object that will be converted to JSON for sending. Must
either be a Java bean or be recognized by the object mapper.ClientException - if a status code other than 201 (Created) is
returned.protected URI doPostCreate(String path, Object o, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the the API to call.o - the object that will be converted to JSON for sending. Must
either be a Java bean or be recognized by the object mapper.headers - If no Content Type header is provided, this method adds a
Content Type header for JSON.ClientException - if a status code other than 200 (OK) and 201
(Created) is returned.protected URI doPostCreateMultipart(String path, InputStream inputStream) throws ClientException
path - the the API to call.inputStream - the multi-part form content.ClientException - if a status code other than 200 (OK) and 201
(Created) is returned.protected URI doPostCreateMultipart(String path, InputStream inputStream, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the the API to call.inputStream - the multi-part form content.headers - any headers to send. If no Accepts header is provided,
this method as an Accepts header for text/plain. If no Content Type
header is provided, this method adds a Content Type header for multi-part
forms data.ClientException - if a status code other than 200 (OK) and 201
(Created) is returned.protected URI doPostCreateMultipart(String path, com.sun.jersey.multipart.FormDataMultiPart formDataMultiPart) throws ClientException
path - the the API to call.formDataMultiPart - the form content.ClientException - if a status code other than 200 (OK) and 201
(Created) is returned.protected com.sun.jersey.api.client.ClientResponse doPostForProxy(String path, InputStream inputStream, javax.ws.rs.core.MultivaluedMap<String,String> parameterMap, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the path to the resource. Cannot be null.inputStream - the contents of the POST body. Cannot be
null.parameterMap - query parameters. May be null.headers - any request headers to add. May be null.ClientException - if the proxied server responds with an "error"
status code, which is dependent on the server being called.for the URL of the proxied server.protected com.sun.jersey.api.client.ClientResponse doPostForProxy(String path, String body, javax.ws.rs.core.MultivaluedMap<String,String> parameterMap, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the path to the resource. Cannot be null.body - the contents of the POST body. Cannot be
null.parameterMap - query parameters. May be null.headers - any request headers to add. May be null.ClientException - if the proxied server responds with an "error"
status code, which is dependent on the server being called.for the URL of the proxied server.protected com.sun.jersey.api.client.ClientResponse doPutForProxy(String path, InputStream inputStream, javax.ws.rs.core.MultivaluedMap<String,String> parameterMap, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the path to the resource. Cannot be null.inputStream - the contents of the update. Cannot be
null.parameterMap - query parameters. May be null.headers - any request headers to add.ClientException - if the proxied server responds with an "error"
status code, which is dependent on the server being called.for the URL of the proxied server.protected com.sun.jersey.api.client.ClientResponse doPutForProxy(String path, String contents, javax.ws.rs.core.MultivaluedMap<String,String> parameterMap, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the path to the resource. Cannot be null.contents - the contents of the update. Cannot be
null.parameterMap - query parameters. May be null.headers - any request headers to add.ClientException - if the proxied server responds with an "error"
status code, which is dependent on the server being called.for the URL of the proxied server.protected com.sun.jersey.api.client.ClientResponse doGetForProxy(String path, javax.ws.rs.core.MultivaluedMap<String,String> parameterMap, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the path to the resource. Cannot be null.parameterMap - query parameters. May be null.headers - any request headers to add.ClientException - if the proxied server responds with an "error"
status code, which is dependent on the server being called.for the URL of the proxied server.protected com.sun.jersey.api.client.ClientResponse doDeleteForProxy(String path, javax.ws.rs.core.MultivaluedMap<String,String> parameterMap, javax.ws.rs.core.MultivaluedMap<String,String> headers) throws ClientException
path - the path to the resource. Cannot be null.parameterMap - query parameters. May be null.headers - any request headers to add.ClientException - if the proxied server responds with an "error"
status code, which is dependent on the server being called.for the URL of the proxied server.protected void errorIfStatusEqualTo(com.sun.jersey.api.client.ClientResponse response,
com.sun.jersey.api.client.ClientResponse.Status... status)
throws ClientException
response - the response.status - the expected status code(s).ClientException - if the response had a status code other than
those listed.protected void errorIfStatusNotEqualTo(com.sun.jersey.api.client.ClientResponse response,
com.sun.jersey.api.client.ClientResponse.Status... status)
throws ClientException
response - the response.status - the expected status code(s).ClientException - if the response had a status code other than
those listed.Copyright © 2016–2018 Emory University. All rights reserved.