public abstract class WatsonService extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
FORWARD_SLASH
The FORWARD_SLASH.
|
| Constructor and Description |
|---|
WatsonService()
Instantiates a new Watson service.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.http.HttpResponse |
execute(org.apache.http.client.methods.HttpRequestBase request)
Execute the Http request.
|
protected <T> T |
executeRequest(Request request,
Class<T> returnType)
Execute the request and return the POJO that represent the response.
|
protected void |
executeWithoutResponse(org.apache.http.client.methods.HttpRequestBase request)
Execute the Http request and discard the response.
|
protected String |
getApiKey()
Gets the API key.
|
protected String |
getDefaultContentType()
Gets the default content type.
|
protected org.apache.http.params.HttpParams |
getDefaultRequestParams()
Gets the default request.
|
String |
getEndPoint()
Gets the API end point.
|
org.apache.http.client.HttpClient |
getHttpClient()
Gets the http client.
|
org.apache.http.client.HttpClient |
getThreadSafeClient()
Gets the thread safe client.
|
void |
setApiKey(String apiKey)
Sets the API key.
|
protected void |
setAuthentication(org.apache.http.client.methods.HttpRequestBase request)
Sets the authentication.
|
void |
setEndPoint(String endPoint)
Sets the end point.
|
void |
setUsernameAndPassword(String username,
String password)
Sets the username and password.
|
String |
toString() |
protected static final String FORWARD_SLASH
protected void executeWithoutResponse(org.apache.http.client.methods.HttpRequestBase request)
request - the requestprotected org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpRequestBase request)
request - the http requestprotected String getApiKey()
protected String getDefaultContentType()
protected org.apache.http.params.HttpParams getDefaultRequestParams()
public String getEndPoint()
public org.apache.http.client.HttpClient getHttpClient()
public org.apache.http.client.HttpClient getThreadSafeClient()
public void setApiKey(String apiKey)
apiKey - the new API keypublic void setEndPoint(String endPoint)
endPoint - the new end pointpublic void setUsernameAndPassword(String username, String password)
username - the usernamepassword - the passwordprotected void setAuthentication(org.apache.http.client.methods.HttpRequestBase request)
request - the new authenticationprotected <T> T executeRequest(Request request, Class<T> returnType)
T - The POJO that represents the response objectrequest - the requestreturnType - the POJO class to be parsed from the responseCopyright © 2015. All rights reserved.