|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springbyexample.httpclient.AbstractHttpClientTemplate<T> org.springbyexample.httpclient.HttpClientOxmTemplate<T>
@Component public class HttpClientOxmTemplate<T>
Template for easier use of HttpClient
and
also uses Spring Web Services OXM framework to marshall/unmarshall
XML from requests and responses.
Field Summary | |
---|---|
protected Marshaller |
marshaller
|
protected Unmarshaller |
unmarshaller
|
Fields inherited from class org.springbyexample.httpclient.AbstractHttpClientTemplate |
---|
authenticationPreemptive, client, connectionManager, defaultUri, lCredentials |
Constructor Summary | |
---|---|
HttpClientOxmTemplate()
Constructor. |
|
HttpClientOxmTemplate(String defaultUri)
Constructor. |
|
HttpClientOxmTemplate(String defaultUri,
Marshaller marshaller,
Unmarshaller unmarshaller)
Constructor. |
|
HttpClientOxmTemplate(String defaultUri,
Marshaller marshaller,
Unmarshaller unmarshaller,
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 |
executePostMethod(String uri,
T requestPayload,
Map<String,String> hParams,
ResponseCallback<?> callback)
Execute post method. |
void |
executePostMethod(T requestPayload)
Execute post method. |
void |
executePostMethod(T requestPayload,
Map<String,String> hParams)
Execute post method. |
void |
executePostMethod(T requestPayload,
Map<String,String> hParams,
ResponseCallback<?> callback)
Execute post method. |
void |
executePostMethod(T requestPayload,
ResponseCallback<?> callback)
Execute post method. |
Marshaller |
getMarshaller()
Gets marshaller. |
Unmarshaller |
getUnmarshaller()
Gets unmarshaller. |
protected void |
processHttpMethod(HttpMethod httpMethod,
ResponseCallback callback)
Processes HttpMethod by executing the method,
validating the response, and calling the callback. |
void |
setMarshaller(Marshaller marshaller)
Sets marshaller. |
void |
setUnmarshaller(Unmarshaller unmarshaller)
Sets unmarshaller. |
Methods inherited from class org.springbyexample.httpclient.AbstractHttpClientTemplate |
---|
destroy, executeGetMethod, executeGetMethod, executeGetMethod, executeGetMethod, executeGetMethod, executeGetMethod, executePostMethod, executePostMethod, executePostMethod, executePostMethod, executePostMethod, getClient, getConnectionManager, getCredentials, getDefaultUri, isAuthenticationPreemptive, processHttpMethodParams, setAuthenticationPreemptive, setClient, setConnectionManager, setCredentials, setDefaultUri, validateResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Marshaller marshaller
protected Unmarshaller unmarshaller
Constructor Detail |
---|
public HttpClientOxmTemplate()
public HttpClientOxmTemplate(String defaultUri)
defaultUri
- Default uri.public HttpClientOxmTemplate(String defaultUri, Marshaller marshaller, Unmarshaller unmarshaller)
defaultUri
- Default uri.marshaller
- Marshaller to use for marshalling requests.unmarshaller
- Unmarshaller to use for unmarshalling requests.public HttpClientOxmTemplate(String defaultUri, Marshaller marshaller, Unmarshaller unmarshaller, boolean init)
defaultUri
- Default uri.marshaller
- Marshaller to use for marshalling requests.unmarshaller
- Unmarshaller to use for unmarshalling requests.init
- Whether or not to initialize the bean.Method Detail |
---|
public Marshaller getMarshaller()
public void setMarshaller(Marshaller marshaller)
public Unmarshaller getUnmarshaller()
public void setUnmarshaller(Unmarshaller unmarshaller)
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 InitializingBean
afterPropertiesSet
in class AbstractHttpClientTemplate<T>
Exception
public void executePostMethod(T requestPayload)
requestPayload
- Request data to post after marshalling.
The Marshaller
should be able to
process this instance.public void executePostMethod(T requestPayload, ResponseCallback<?> callback)
requestPayload
- Request data to post after marshalling.
The Marshaller
should be able to
process this instance.callback
- Callback with HTTP method's response.public void executePostMethod(T requestPayload, Map<String,String> hParams)
requestPayload
- Request data to post after marshalling.
The Marshaller
should be able to
process this instance.hParams
- Parameters for the HTTP post.public void executePostMethod(T requestPayload, Map<String,String> hParams, ResponseCallback<?> callback)
requestPayload
- Request data to post after marshalling.
The Marshaller
should be able to
process this instance.hParams
- Parameters for the HTTP post.callback
- Callback with HTTP method's response.public void executePostMethod(String uri, T requestPayload, Map<String,String> hParams, ResponseCallback<?> callback)
executePostMethod
in class AbstractHttpClientTemplate<T>
uri
- URI to use when processing this HTTP request instead
of using the default URI.requestPayload
- Request data to post after marshalling.
The Marshaller
should be able to
process this instance.hParams
- Parameters for the HTTP post.callback
- Callback with HTTP method's response.protected void processHttpMethod(HttpMethod httpMethod, ResponseCallback callback)
HttpMethod
by executing the method,
validating the response, and calling the callback.
processHttpMethod
in class AbstractHttpClientTemplate<T>
httpMethod
- HttpMethod
to process.callback
- Callback with HTTP method's response.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |