org.springframework.integration.http
Class CommonsHttpRequestExecutor

java.lang.Object
  extended by org.springframework.integration.http.AbstractHttpRequestExecutor
      extended by org.springframework.integration.http.CommonsHttpRequestExecutor
All Implemented Interfaces:
HttpRequestExecutor

public class CommonsHttpRequestExecutor
extends AbstractHttpRequestExecutor

Implementation of HttpRequestExecutor that uses a commons-http HttpClient to execute HttpRequest instances.

Since:
1.0.2
Author:
Mark Fisher, Juergen Hoeller

Field Summary
 
Fields inherited from class org.springframework.integration.http.AbstractHttpRequestExecutor
ENCODING_GZIP, HTTP_HEADER_ACCEPT_ENCODING, HTTP_HEADER_ACCEPT_LANGUAGE, HTTP_HEADER_CONTENT_ENCODING, HTTP_HEADER_CONTENT_LENGTH, HTTP_HEADER_CONTENT_TYPE, logger
 
Constructor Summary
CommonsHttpRequestExecutor()
          Create a new CommonsHttpRequestExecutor with a default HttpClient that uses a default MultiThreadedHttpConnectionManager.
CommonsHttpRequestExecutor(org.apache.commons.httpclient.HttpClient httpClient)
          Create a new CommonsHttpRequestExecutor with the given HttpClient instance.
 
Method Summary
protected  HttpResponse doExecuteRequest(HttpRequest request)
          Subclasses must implement this method to execute the request.
 org.apache.commons.httpclient.HttpClient getHttpClient()
          Return the HttpClient instance that this request executor uses.
 void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
          Set the HttpClient instance to use for this request executor.
 void setReadTimeout(int timeout)
          Set the socket read timeout for the underlying HttpClient.
 
Methods inherited from class org.springframework.integration.http.AbstractHttpRequestExecutor
executeRequest, isAcceptGzipEncoding, setAcceptGzipEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonsHttpRequestExecutor

public CommonsHttpRequestExecutor()
Create a new CommonsHttpRequestExecutor with a default HttpClient that uses a default MultiThreadedHttpConnectionManager. Sets the socket read timeout to DEFAULT_READ_TIMEOUT_MILLISECONDS.

See Also:
HttpClient, MultiThreadedHttpConnectionManager

CommonsHttpRequestExecutor

public CommonsHttpRequestExecutor(org.apache.commons.httpclient.HttpClient httpClient)
Create a new CommonsHttpRequestExecutor with the given HttpClient instance. The socket read timeout of the provided HttpClient will not be changed.

Parameters:
httpClient - the HttpClient instance to use for this request executor
Method Detail

setHttpClient

public void setHttpClient(org.apache.commons.httpclient.HttpClient httpClient)
Set the HttpClient instance to use for this request executor.


getHttpClient

public org.apache.commons.httpclient.HttpClient getHttpClient()
Return the HttpClient instance that this request executor uses.


setReadTimeout

public void setReadTimeout(int timeout)
Set the socket read timeout for the underlying HttpClient. A value of 0 means never timeout.

Parameters:
timeout - the timeout value in milliseconds
See Also:
HttpConnectionParams.setSoTimeout(int), DEFAULT_READ_TIMEOUT_MILLISECONDS

doExecuteRequest

protected HttpResponse doExecuteRequest(HttpRequest request)
                                 throws java.lang.Exception
Description copied from class: AbstractHttpRequestExecutor
Subclasses must implement this method to execute the request.

Specified by:
doExecuteRequest in class AbstractHttpRequestExecutor
Throws:
java.lang.Exception