From 8041f6abdd29bcc8aae9f3fe4637cb130c67fd5d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 13 Jul 2011 23:03:50 +0000 Subject: [PATCH] polishing --- .../CommonsClientHttpRequestFactory.java | 4 ++-- .../client/SimpleClientHttpRequestFactory.java | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java b/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java index 7521a5ed46b..056ddea3288 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java +++ b/org.springframework.web/src/main/java/org/springframework/http/client/CommonsClientHttpRequestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public class CommonsClientHttpRequestFactory implements ClientHttpRequestFactory * {@link HttpClient} that uses a default {@link MultiThreadedHttpConnectionManager}. */ public CommonsClientHttpRequestFactory() { - httpClient = new HttpClient(new MultiThreadedHttpConnectionManager()); + this.httpClient = new HttpClient(new MultiThreadedHttpConnectionManager()); this.setReadTimeout(DEFAULT_READ_TIMEOUT_MILLISECONDS); } diff --git a/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java b/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java index cf864fcfc07..ef20892e9d8 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java +++ b/org.springframework.web/src/main/java/org/springframework/http/client/SimpleClientHttpRequestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,21 +30,23 @@ import org.springframework.util.Assert; * {@link ClientHttpRequestFactory} implementation that uses standard J2SE facilities. * * @author Arjen Poutsma + * @since 3.0 * @see java.net.HttpURLConnection * @see CommonsClientHttpRequestFactory - * @since 3.0 */ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory { private Proxy proxy; + /** - * Sets the {@link Proxy} to use for this request factory. + * Set the {@link Proxy} to use for this request factory. */ public void setProxy(Proxy proxy) { this.proxy = proxy; } + public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException { HttpURLConnection connection = openConnection(uri.toURL(), proxy); prepareConnection(connection, httpMethod.name()); @@ -53,16 +55,15 @@ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory /** * Opens and returns a connection to the given URL. - *

The default implementation uses the given {@linkplain #setProxy(java.net.Proxy) proxy} - if any - to open a - * connection. - * + *

The default implementation uses the given {@linkplain #setProxy(java.net.Proxy) proxy} - + * if any - to open a connection. * @param url the URL to open a connection to * @param proxy the proxy to use, may be {@code null} * @return the opened connection * @throws IOException in case of I/O errors */ protected HttpURLConnection openConnection(URL url, Proxy proxy) throws IOException { - URLConnection urlConnection = proxy != null ? url.openConnection(proxy) : url.openConnection(); + URLConnection urlConnection = (proxy != null ? url.openConnection(proxy) : url.openConnection()); Assert.isInstanceOf(HttpURLConnection.class, urlConnection); return (HttpURLConnection) urlConnection; } @@ -70,7 +71,6 @@ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory /** * Template method for preparing the given {@link HttpURLConnection}. *

The default implementation prepares the connection for input and output, and sets the HTTP method. - * * @param connection the connection to prepare * @param httpMethod the HTTP request method ({@code GET}, {@code POST}, etc.) * @throws IOException in case of I/O errors @@ -92,4 +92,4 @@ public class SimpleClientHttpRequestFactory implements ClientHttpRequestFactory connection.setRequestMethod(httpMethod); } -} \ No newline at end of file +}