|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springbyexample.httpclient.AbstractHttpClientTemplate<T>
public abstract class AbstractHttpClientTemplate<T>
Base HttpClient template class.
| Field Summary | |
|---|---|
protected boolean |
authenticationPreemptive
|
protected HttpClient |
client
|
protected HttpConnectionManager |
connectionManager
|
protected String |
defaultUri
|
protected List<Credentials> |
lCredentials
|
| Constructor Summary | |
|---|---|
AbstractHttpClientTemplate()
Constructor. |
|
AbstractHttpClientTemplate(String defaultUri)
Constructor. |
|
AbstractHttpClientTemplate(String defaultUri,
boolean init)
Constructor. |
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
Implementation of InitializingBean
that initializes the HttpClient if it is null
and also sets the connection manager to MultiThreadedHttpConnectionManager
if it is null while initializing the HttpClient. |
void |
destroy()
Implementation of DisposableBean that
shuts down the connection manager if it is an instance of
MultiThreadedHttpConnectionManager. |
void |
executeGetMethod()
Execute get method. |
void |
executeGetMethod(Map<String,String> hParams)
Execute get method. |
void |
executeGetMethod(Map<String,String> hParams,
ResponseCallback<?> callback)
Execute get method. |
void |
executeGetMethod(ResponseCallback<?> callback)
Execute get method. |
void |
executeGetMethod(String uri,
Map<String,String> hParams)
Execute get method. |
void |
executeGetMethod(String uri,
Map<String,String> hParams,
ResponseCallback<?> callback)
Execute get method. |
void |
executePostMethod()
Execute post method. |
void |
executePostMethod(Map<String,String> hParams)
Execute post method. |
void |
executePostMethod(Map<String,String> hParams,
ResponseCallback<?> callback)
Execute post method. |
void |
executePostMethod(ResponseCallback<?> callback)
Execute post method. |
void |
executePostMethod(String uri,
T requestPayload,
Map<String,String> hParams)
Execute post method. |
abstract void |
executePostMethod(String uri,
T requestPayload,
Map<String,String> hParams,
ResponseCallback<?> callback)
Execute post method. |
HttpClient |
getClient()
Gets http client. |
HttpConnectionManager |
getConnectionManager()
Gets connection manager. |
List<Credentials> |
getCredentials()
Gets HTTP authorization credentials. |
String |
getDefaultUri()
Gets default uri. |
boolean |
isAuthenticationPreemptive()
Whether or not authentication is preemptive. |
protected abstract void |
processHttpMethod(HttpMethod httpMethod,
ResponseCallback<?> callback)
Processes HttpMethod by executing the method,
validating the response, and calling the callback. |
protected void |
processHttpMethodParams(HttpMethod httpMethod,
Map<String,String> hParams)
Processes HttpMethod parameters. |
void |
setAuthenticationPreemptive(boolean authenticationPreemptive)
Sets whether or not authentication is preemptive. |
void |
setClient(HttpClient client)
Sets http client. |
void |
setConnectionManager(HttpConnectionManager connectionManager)
Sets connection manager. |
void |
setCredentials(List<Credentials> credentials)
Sets HTTP authorization credentials. |
void |
setDefaultUri(String defaultUri)
Sets default uri. |
protected void |
validateResponse(HttpMethod httpMethod)
Validate response. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HttpClient client
protected HttpConnectionManager connectionManager
protected String defaultUri
protected boolean authenticationPreemptive
protected List<Credentials> lCredentials
| Constructor Detail |
|---|
public AbstractHttpClientTemplate()
public AbstractHttpClientTemplate(String defaultUri)
defaultUri - Default uri.
public AbstractHttpClientTemplate(String defaultUri,
boolean init)
defaultUri - Default uri.init - Whether or not to initialize the bean
(typically for programatic use).| Method Detail |
|---|
public HttpClient getClient()
public void setClient(HttpClient client)
public HttpConnectionManager getConnectionManager()
public void setConnectionManager(HttpConnectionManager connectionManager)
public String getDefaultUri()
public void setDefaultUri(String defaultUri)
public boolean isAuthenticationPreemptive()
true, authentication credentials
will be sent before a challenge is issued
for an authentication scope with credentials.
Defaults to false.
public void setAuthenticationPreemptive(boolean authenticationPreemptive)
true, authentication credentials
will be sent before a challenge is issued
for an authentication scope with credentials.
Defaults to false.
public List<Credentials> getCredentials()
public void setCredentials(List<Credentials> credentials)
public void afterPropertiesSet()
throws Exception
InitializingBean
that initializes the HttpClient if it is null
and also sets the connection manager to MultiThreadedHttpConnectionManager
if it is null while initializing the HttpClient.
afterPropertiesSet in interface InitializingBeanException
public void destroy()
throws Exception
DisposableBean that
shuts down the connection manager if it is an instance of
MultiThreadedHttpConnectionManager.
destroy in interface DisposableBeanExceptionpublic void executeGetMethod()
public void executeGetMethod(ResponseCallback<?> callback)
callback - Callback with HTTP method's response.public void executeGetMethod(Map<String,String> hParams)
hParams - Parameters for the HTTP get.
public void executeGetMethod(Map<String,String> hParams,
ResponseCallback<?> callback)
hParams - Parameters for the HTTP get.callback - Callback with HTTP method's response.
public void executeGetMethod(String uri,
Map<String,String> hParams)
uri - URI to use when processing this HTTP request instead
of using the default URI.hParams - Parameters for the HTTP get.
public void executeGetMethod(String uri,
Map<String,String> hParams,
ResponseCallback<?> callback)
uri - URI to use when processing this HTTP request instead
of using the default URI.hParams - Parameters for the HTTP get.callback - Callback with HTTP method's response.public void executePostMethod()
public void executePostMethod(ResponseCallback<?> callback)
callback - Callback with HTTP method's response.public void executePostMethod(Map<String,String> hParams)
hParams - Parameters for the HTTP post.
public void executePostMethod(Map<String,String> hParams,
ResponseCallback<?> callback)
hParams - Parameters for the HTTP post.callback - Callback with HTTP method's response.
public void executePostMethod(String uri,
T requestPayload,
Map<String,String> hParams)
uri - URI to use when processing this HTTP request instead
of using the default URI.requestPayload - Request data to post.hParams - Parameters for the HTTP post.
public abstract void executePostMethod(String uri,
T requestPayload,
Map<String,String> hParams,
ResponseCallback<?> callback)
uri - URI to use when processing this HTTP request instead
of using the default URI.requestPayload - Request data to post.hParams - Parameters for the HTTP post.callback - Callback with HTTP method's response.
protected abstract void processHttpMethod(HttpMethod httpMethod,
ResponseCallback<?> callback)
HttpMethod by executing the method,
validating the response, and calling the callback.
httpMethod - HttpMethod to process.callback - Callback with HTTP method's response.
protected void processHttpMethodParams(HttpMethod httpMethod,
Map<String,String> hParams)
HttpMethod parameters.
httpMethod - HttpMethod to process.hParams - Parameters for the HTTP get.protected void validateResponse(HttpMethod httpMethod)
httpMethod - HttpMethod to validate.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||