|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsmartrics.rest.client.RestClientImpl
public class RestClientImpl
A generic REST client based on HttpClient.
| Constructor Summary | |
|---|---|
RestClientImpl(org.apache.commons.httpclient.HttpClient client)
Constructor allowing the injection of an org.apache.commons.httpclient.HttpClient. |
|
| Method Summary | |
|---|---|
protected void |
configureHttpMethod(org.apache.commons.httpclient.HttpMethod m,
String hostAddr,
RestRequest request)
Configures the instance of HttpMethod with the data in the request and the host address. |
protected org.apache.commons.httpclient.HttpMethod |
createHttpClientMethod(RestRequest request)
Utility method that creates an instance of org.apache.commons.httpclient.HttpMethod. |
protected org.apache.commons.httpclient.URI |
createUri(String uriString,
boolean escaped)
|
RestResponse |
execute(RestRequest request)
See RestClient.execute(smartrics.rest.client.RestRequest) |
RestResponse |
execute(String hostAddr,
RestRequest request)
See RestClient.execute(java.lang.String, smartrics.rest.client.RestRequest) |
String |
getBaseUrl()
See RestClient.getBaseUrl() |
org.apache.commons.httpclient.HttpClient |
getClient()
Returns the Http client instance used by this implementation. |
String |
getContentType(RestRequest request)
|
protected String |
getMethodClassnameFromMethodName(String mName)
factory method that maps a string with a HTTP method name to an implementation class in Apache HttpClient. |
void |
setBaseUrl(String bUrl)
See RestClient.setBaseUrl(java.lang.String) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RestClientImpl(org.apache.commons.httpclient.HttpClient client)
org.apache.commons.httpclient.HttpClient.
client - the client
See HttpClient| Method Detail |
|---|
public void setBaseUrl(String bUrl)
RestClient.setBaseUrl(java.lang.String)
setBaseUrl in interface RestClientbUrl - a string with the base Url.
See RestClient.execute(RestRequest)public String getBaseUrl()
RestClient.getBaseUrl()
getBaseUrl in interface RestClientRestClient.setBaseUrl(String)public org.apache.commons.httpclient.HttpClient getClient()
HttpClient
See RestClientImpl(HttpClient)public RestResponse execute(RestRequest request)
RestClient.execute(smartrics.rest.client.RestRequest)
execute in interface RestClientrequest - the request to be executed
public RestResponse execute(String hostAddr,
RestRequest request)
RestClient.execute(java.lang.String, smartrics.rest.client.RestRequest)
execute in interface RestClienthostAddr - the base Urlrequest - the request to be executed
RestClient.setBaseUrl(java.lang.String)
protected void configureHttpMethod(org.apache.commons.httpclient.HttpMethod m,
String hostAddr,
RestRequest request)
m - the method class to configurehostAddr - the host addressrequest - the rest requestpublic String getContentType(RestRequest request)
protected org.apache.commons.httpclient.URI createUri(String uriString,
boolean escaped)
throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIExceptionprotected String getMethodClassnameFromMethodName(String mName)
org.apache.commons.httpclient.methods.%sMethod where
%s is the parameter mName.
mName - the method name
protected org.apache.commons.httpclient.HttpMethod createHttpClientMethod(RestRequest request)
org.apache.commons.httpclient.HttpMethod.
request - the rest request
org.apache.commons.httpclient.HttpMethod
matching the method in RestRequest.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||