| java.lang.Object |
| ↳ |
org.mule.modules.handshake.client.impl.AbstractHandshakeClient |
Known Direct Subclasses
|
Class Overview
Base class for all the service client in this project. The class handles:
- base URL creation
- creation of the Jersey client
- set up of basic authentication headers
- read of files from input streams
- string serialization of the responses
Summary
| Fields |
|
private
final
String |
baseUrl |
|
|
protected
final
Gson |
gson |
|
| Protected Methods |
|
abstract
StringBuilder
|
extendGetBaseUrl(StringBuilder baseUrl)
This method is called by getBaseURL for the user to extend the base URL
of its ServiceClient implementation.
|
|
<T>
HandshakeAPIResponse<T>
|
get(WebResource.Builder resourceBuilder, Type type)
|
|
String
|
getBaseURL()
|
|
WebResource.Builder
|
getBuilder(String user, String password, String antiThrottleKey, String url, Map<String, String> queryParameters)
Creates a Builder
|
|
ClientConfig
|
getJerseyClientConfiguration()
This method is called by getBuilder before the creation of the
Client.
|
|
MultivaluedMap<String, String>
|
mapToMultivaluedMap(Map<String, String> map)
Transform a map in a MultivaluedMap which is needed by Jersey to
send query parameters.
|
|
<V>
V
|
parseJson(String string, Type type)
Parse JSON to specified type
|
|
<T>
T
|
post(WebResource.Builder resourceBuilder, Type requestType, Type responseType, Object params)
|
|
String
|
readResponseFromClientResponse(ClientResponse clientResponse)
|
|
<T>
T
|
singleGet(WebResource.Builder resourceBuilder, Type type)
|
|
<T>
T
|
update(WebResource.Builder resourceBuilder, Type objectType, T edited)
|
|
[Expand]
Inherited Methods |
From class
java.lang.Object
|
Object
|
clone()
|
|
boolean
|
equals(Object arg0)
|
|
void
|
finalize()
|
|
final
Class<?>
|
getClass()
|
|
int
|
hashCode()
|
|
final
void
|
notify()
|
|
final
void
|
notifyAll()
|
|
String
|
toString()
|
|
final
void
|
wait()
|
|
final
void
|
wait(long arg0, int arg1)
|
|
final
void
|
wait(long arg0)
|
|
Fields
private
final
String
baseUrl
protected
final
Gson
gson
Public Constructors
public
AbstractHandshakeClient
(String baseUrl)
Protected Methods
protected
abstract
StringBuilder
extendGetBaseUrl
(StringBuilder baseUrl)
This method is called by getBaseURL for the user to extend the base URL
of its ServiceClient implementation.
Parameters
| baseUrl
| A builder with the Base Url |
Returns
- the builder, with the extended content as needed
protected
String
getBaseURL
()
protected
WebResource.Builder
getBuilder
(String user, String password, String antiThrottleKey, String url, Map<String, String> queryParameters)
Parameters
| user
| For authentication |
| password
| For authentication |
| antiThrottleKey
| |
| url
| The URL to be hit by the client |
| queryParameters
| A map containing all the query parameters |
protected
ClientConfig
getJerseyClientConfiguration
()
This method is called by getBuilder before the creation of the
Client. The ClientConfig is used to create the
Client.
protected
MultivaluedMap<String, String>
mapToMultivaluedMap
(Map<String, String> map)
Transform a map in a MultivaluedMap which is needed by Jersey to
send query parameters. It also validate that not empty parameters are
being send.
Parameters
| map
| The map of query parameters |
Returns
- the same map in an MultivaluedMap object.
protected
V
parseJson
(String string, Type type)
Parse JSON to specified type
Parameters
| string
| JSON-formatted string to parse |
| type
| Of the object to obtain |
Throws
| IOException
| if the string is not JSON-formatted
|
protected
T
post
(WebResource.Builder resourceBuilder, Type requestType, Type responseType, Object params)
Parameters
| resourceBuilder
| |
| requestType
| |
| responseType
| |
| params
| |
protected
String
readResponseFromClientResponse
(ClientResponse clientResponse)
protected
T
singleGet
(WebResource.Builder resourceBuilder, Type type)
protected
T
update
(WebResource.Builder resourceBuilder, Type objectType, T edited)
Parameters
| resourceBuilder
| |
| objectType
| |
| edited
| |