polishing

This commit is contained in:
Juergen Hoeller 2011-08-15 21:23:53 +00:00
parent cce1e2010d
commit 20f748865e
2 changed files with 12 additions and 16 deletions

View File

@ -64,7 +64,7 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
/** /**
* Create a new instance of the {@code HttpComponentsClientHttpRequestFactory} with a default * Create a new instance of the HttpComponentsClientHttpRequestFactory with a default
* {@link HttpClient} that uses a default {@link org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager}. * {@link HttpClient} that uses a default {@link org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager}.
*/ */
public HttpComponentsClientHttpRequestFactory() { public HttpComponentsClientHttpRequestFactory() {
@ -82,9 +82,9 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
/** /**
* Create a new instance of the {@code HttpComponentsClientHttpRequestFactory} * Create a new instance of the HttpComponentsClientHttpRequestFactory
* with the given {@link HttpClient} instance. * with the given {@link HttpClient} instance.
* @param httpClient the HttpClient instance to use for this factory * @param httpClient the HttpClient instance to use for this request factory
*/ */
public HttpComponentsClientHttpRequestFactory(HttpClient httpClient) { public HttpComponentsClientHttpRequestFactory(HttpClient httpClient) {
Assert.notNull(httpClient, "HttpClient must not be null"); Assert.notNull(httpClient, "HttpClient must not be null");
@ -110,7 +110,6 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
* Set the connection timeout for the underlying HttpClient. * Set the connection timeout for the underlying HttpClient.
* A timeout value of 0 specifies an infinite timeout. * A timeout value of 0 specifies an infinite timeout.
* @param timeout the timeout value in milliseconds * @param timeout the timeout value in milliseconds
* @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setConnectionTimeout(int)
*/ */
public void setConnectTimeout(int timeout) { public void setConnectTimeout(int timeout) {
Assert.isTrue(timeout < 0, "Timeout must be a non-negative value"); Assert.isTrue(timeout < 0, "Timeout must be a non-negative value");
@ -121,7 +120,6 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
* Set the socket read timeout for the underlying HttpClient. * Set the socket read timeout for the underlying HttpClient.
* A timeout value of 0 specifies an infinite timeout. * A timeout value of 0 specifies an infinite timeout.
* @param timeout the timeout value in milliseconds * @param timeout the timeout value in milliseconds
* @see org.apache.commons.httpclient.params.HttpConnectionManagerParams#setSoTimeout(int)
*/ */
public void setReadTimeout(int timeout) { public void setReadTimeout(int timeout) {
Assert.isTrue(timeout < 0, "Timeout must be a non-negative value"); Assert.isTrue(timeout < 0, "Timeout must be a non-negative value");

View File

@ -171,10 +171,9 @@ public class CommonsHttpInvokerRequestExecutor extends AbstractHttpInvokerReques
/** /**
* Set the given serialized remote invocation as request body. * Set the given serialized remote invocation as request body.
* <p>The default implementation simply sets the serialized invocation * <p>The default implementation simply sets the serialized invocation as the
* as the PostMethod's request body. This can be overridden, for example, * PostMethod's request body. This can be overridden, for example, to write a
* to write a specific encoding and potentially set appropriate HTTP * specific encoding and to potentially set appropriate HTTP request headers.
* request headers.
* @param config the HTTP invoker configuration that specifies the target service * @param config the HTTP invoker configuration that specifies the target service
* @param postMethod the PostMethod to set the request body on * @param postMethod the PostMethod to set the request body on
* @param baos the ByteArrayOutputStream that contains the serialized * @param baos the ByteArrayOutputStream that contains the serialized
@ -228,11 +227,10 @@ public class CommonsHttpInvokerRequestExecutor extends AbstractHttpInvokerReques
} }
/** /**
* Extract the response body from the given executed remote invocation * Extract the response body from the given executed remote invocation request.
* request. * <p>The default implementation simply fetches the PostMethod's response body stream.
* <p>The default implementation simply fetches the PostMethod's response * If the response is recognized as GZIP response, the InputStream will get wrapped
* body stream. If the response is recognized as GZIP response, the * in a GZIPInputStream.
* InputStream will get wrapped in a GZIPInputStream.
* @param config the HTTP invoker configuration that specifies the target service * @param config the HTTP invoker configuration that specifies the target service
* @param postMethod the PostMethod to read the response body from * @param postMethod the PostMethod to read the response body from
* @return an InputStream for the response body * @return an InputStream for the response body
@ -255,7 +253,7 @@ public class CommonsHttpInvokerRequestExecutor extends AbstractHttpInvokerReques
/** /**
* Determine whether the given response indicates a GZIP response. * Determine whether the given response indicates a GZIP response.
* <p>Default implementation checks whether the HTTP "Content-Encoding" * <p>The default implementation checks whether the HTTP "Content-Encoding"
* header contains "gzip" (in any casing). * header contains "gzip" (in any casing).
* @param postMethod the PostMethod to check * @param postMethod the PostMethod to check
* @return whether the given response indicates a GZIP response * @return whether the given response indicates a GZIP response
@ -263,7 +261,7 @@ public class CommonsHttpInvokerRequestExecutor extends AbstractHttpInvokerReques
protected boolean isGzipResponse(PostMethod postMethod) { protected boolean isGzipResponse(PostMethod postMethod) {
Header encodingHeader = postMethod.getResponseHeader(HTTP_HEADER_CONTENT_ENCODING); Header encodingHeader = postMethod.getResponseHeader(HTTP_HEADER_CONTENT_ENCODING);
return (encodingHeader != null && encodingHeader.getValue() != null && return (encodingHeader != null && encodingHeader.getValue() != null &&
encodingHeader.getValue().toLowerCase().indexOf(ENCODING_GZIP) != -1); encodingHeader.getValue().toLowerCase().contains(ENCODING_GZIP));
} }
} }