You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2010/04/23 21:19:31 UTC
svn commit: r937479 [6/12] - in /httpcomponents/httpclient/trunk:
httpclient-benchmark/src/main/java/org/apache/http/client/benchmark/
httpclient-contrib/src/main/java/org/apache/http/contrib/auth/
httpclient/src/main/java/org/apache/http/auth/ httpcli...
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java Fri Apr 23 19:19:23 2010
@@ -69,85 +69,85 @@ import org.apache.http.protocol.HttpRequ
import org.apache.http.protocol.ImmutableHttpProcessor;
/**
- * Base class for {@link HttpClient} implementations. This class acts as
- * a facade to a number of special purpose handler or strategy
- * implementations responsible for handling of a particular aspect of
- * the HTTP protocol such as redirect or authentication handling or
- * making decision about connection persistence and keep alive duration.
- * This enables the users to selectively replace default implementation
- * of those aspects with custom, application specific ones. This class
+ * Base class for {@link HttpClient} implementations. This class acts as
+ * a facade to a number of special purpose handler or strategy
+ * implementations responsible for handling of a particular aspect of
+ * the HTTP protocol such as redirect or authentication handling or
+ * making decision about connection persistence and keep alive duration.
+ * This enables the users to selectively replace default implementation
+ * of those aspects with custom, application specific ones. This class
* also provides factory methods to instantiate those objects:
* <ul>
- * <li>{@link HttpRequestExecutor}</li> object used to transmit messages
+ * <li>{@link HttpRequestExecutor}</li> object used to transmit messages
* over HTTP connections. The {@link #createRequestExecutor()} must be
- * implemented by concrete super classes to instantiate this object.
- * <li>{@link BasicHttpProcessor}</li> object to manage a list of protocol
- * interceptors and apply cross-cutting protocol logic to all incoming
+ * implemented by concrete super classes to instantiate this object.
+ * <li>{@link BasicHttpProcessor}</li> object to manage a list of protocol
+ * interceptors and apply cross-cutting protocol logic to all incoming
* and outgoing HTTP messages. The {@link #createHttpProcessor()} must be
* implemented by concrete super classes to instantiate this object.
* <li>{@link HttpRequestRetryHandler}</li> object used to decide whether
- * or not a failed HTTP request is safe to retry automatically.
+ * or not a failed HTTP request is safe to retry automatically.
* The {@link #createHttpRequestRetryHandler()} must be
* implemented by concrete super classes to instantiate this object.
- * <li>{@link ClientConnectionManager}</li> object used to manage
+ * <li>{@link ClientConnectionManager}</li> object used to manage
* persistent HTTP connections.
- * <li>{@link ConnectionReuseStrategy}</li> object used to decide whether
- * or not a HTTP connection can be kept alive and re-used for subsequent
+ * <li>{@link ConnectionReuseStrategy}</li> object used to decide whether
+ * or not a HTTP connection can be kept alive and re-used for subsequent
* HTTP requests. The {@link #createConnectionReuseStrategy()} must be
* implemented by concrete super classes to instantiate this object.
* <li>{@link ConnectionKeepAliveStrategy}</li> object used to decide how
* long a persistent HTTP connection can be kept alive.
* The {@link #createConnectionKeepAliveStrategy()} must be
* implemented by concrete super classes to instantiate this object.
- * <li>{@link CookieSpecRegistry}</li> object used to maintain a list of
- * supported cookie specifications.
- * The {@link #createCookieSpecRegistry()} must be implemented by concrete
+ * <li>{@link CookieSpecRegistry}</li> object used to maintain a list of
+ * supported cookie specifications.
+ * The {@link #createCookieSpecRegistry()} must be implemented by concrete
* super classes to instantiate this object.
* <li>{@link CookieStore}</li> object used to maintain a collection of
- * cookies. The {@link #createCookieStore()} must be implemented by
+ * cookies. The {@link #createCookieStore()} must be implemented by
* concrete super classes to instantiate this object.
- * <li>{@link AuthSchemeRegistry}</li> object used to maintain a list of
- * supported authentication schemes.
- * The {@link #createAuthSchemeRegistry()} must be implemented by concrete
+ * <li>{@link AuthSchemeRegistry}</li> object used to maintain a list of
+ * supported authentication schemes.
+ * The {@link #createAuthSchemeRegistry()} must be implemented by concrete
* super classes to instantiate this object.
- * <li>{@link CredentialsProvider}</li> object used to maintain
- * a collection user credentials. The {@link #createCredentialsProvider()}
- * must be implemented by concrete super classes to instantiate
+ * <li>{@link CredentialsProvider}</li> object used to maintain
+ * a collection user credentials. The {@link #createCredentialsProvider()}
+ * must be implemented by concrete super classes to instantiate
* this object.
* <li>{@link AuthenticationHandler}</li> object used to authenticate
- * against the target host.
- * The {@link #createTargetAuthenticationHandler()} must be implemented
+ * against the target host.
+ * The {@link #createTargetAuthenticationHandler()} must be implemented
* by concrete super classes to instantiate this object.
* <li>{@link AuthenticationHandler}</li> object used to authenticate
- * against the proxy host.
- * The {@link #createProxyAuthenticationHandler()} must be implemented
+ * against the proxy host.
+ * The {@link #createProxyAuthenticationHandler()} must be implemented
* by concrete super classes to instantiate this object.
* <li>{@link HttpRoutePlanner}</li> object used to calculate a route
* for establishing a connection to the target host. The route
- * may involve multiple intermediate hops.
- * The {@link #createHttpRoutePlanner()} must be implemented
+ * may involve multiple intermediate hops.
+ * The {@link #createHttpRoutePlanner()} must be implemented
* by concrete super classes to instantiate this object.
- * <li>{@link RedirectStrategy}</li> object used to determine if an HTTP
- * request should be redirected to a new location in response to an HTTP
- * response received from the target server.
- * <li>{@link UserTokenHandler}</li> object used to determine if the
- * execution context is user identity specific.
- * The {@link #createUserTokenHandler()} must be implemented by
+ * <li>{@link RedirectStrategy}</li> object used to determine if an HTTP
+ * request should be redirected to a new location in response to an HTTP
+ * response received from the target server.
+ * <li>{@link UserTokenHandler}</li> object used to determine if the
+ * execution context is user identity specific.
+ * The {@link #createUserTokenHandler()} must be implemented by
* concrete super classes to instantiate this object.
- * </ul>
+ * </ul>
* <p>
- * This class also maintains a list of protocol interceptors intended
- * for processing outgoing requests and incoming responses and provides
- * methods for managing those interceptors. New protocol interceptors can be
- * introduced to the protocol processor chain or removed from it if needed.
- * Internally protocol interceptors are stored in a simple
- * {@link java.util.ArrayList}. They are executed in the same natural order
+ * This class also maintains a list of protocol interceptors intended
+ * for processing outgoing requests and incoming responses and provides
+ * methods for managing those interceptors. New protocol interceptors can be
+ * introduced to the protocol processor chain or removed from it if needed.
+ * Internally protocol interceptors are stored in a simple
+ * {@link java.util.ArrayList}. They are executed in the same natural order
* as they are added to the list.
* <p>
- * AbstractHttpClient is thread safe. It is recommended that the same
- * instance of this class is reused for multiple request executions.
- * When an instance of DefaultHttpClient is no longer needed and is about
- * to go out of scope the connection manager associated with it must be
+ * AbstractHttpClient is thread safe. It is recommended that the same
+ * instance of this class is reused for multiple request executions.
+ * When an instance of DefaultHttpClient is no longer needed and is about
+ * to go out of scope the connection manager associated with it must be
* shut down by calling {@link ClientConnectionManager#shutdown()}!
*
* @since 4.0
@@ -172,7 +172,7 @@ public abstract class AbstractHttpClient
/** The connection re-use strategy. */
@GuardedBy("this")
private ConnectionReuseStrategy reuseStrategy;
-
+
/** The connection keep-alive strategy. */
@GuardedBy("this")
private ConnectionKeepAliveStrategy keepAliveStrategy;
@@ -184,14 +184,14 @@ public abstract class AbstractHttpClient
/** The authentication scheme registry. */
@GuardedBy("this")
private AuthSchemeRegistry supportedAuthSchemes;
-
+
/** The HTTP protocol processor and its immutable copy. */
@GuardedBy("this")
private BasicHttpProcessor mutableProcessor;
@GuardedBy("this")
private ImmutableHttpProcessor protocolProcessor;
-
+
/** The request retry handler. */
@GuardedBy("this")
private HttpRequestRetryHandler retryHandler;
@@ -215,7 +215,7 @@ public abstract class AbstractHttpClient
/** The credentials provider. */
@GuardedBy("this")
private CredentialsProvider credsProvider;
-
+
/** The route planner. */
@GuardedBy("this")
private HttpRoutePlanner routePlanner;
@@ -240,10 +240,10 @@ public abstract class AbstractHttpClient
protected abstract HttpParams createHttpParams();
-
+
protected abstract HttpContext createHttpContext();
-
+
protected abstract HttpRequestExecutor createRequestExecutor();
@@ -252,41 +252,41 @@ public abstract class AbstractHttpClient
protected abstract AuthSchemeRegistry createAuthSchemeRegistry();
-
+
protected abstract CookieSpecRegistry createCookieSpecRegistry();
-
+
protected abstract ConnectionReuseStrategy createConnectionReuseStrategy();
-
+
protected abstract ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy();
-
+
protected abstract BasicHttpProcessor createHttpProcessor();
-
+
protected abstract HttpRequestRetryHandler createHttpRequestRetryHandler();
-
+
@Deprecated
protected abstract org.apache.http.client.RedirectHandler createRedirectHandler();
protected abstract AuthenticationHandler createTargetAuthenticationHandler();
-
+
protected abstract AuthenticationHandler createProxyAuthenticationHandler();
-
+
protected abstract CookieStore createCookieStore();
-
-
+
+
protected abstract CredentialsProvider createCredentialsProvider();
-
-
+
+
protected abstract HttpRoutePlanner createHttpRoutePlanner();
-
+
protected abstract UserTokenHandler createUserTokenHandler();
// non-javadoc, see interface HttpClient
@@ -350,7 +350,7 @@ public abstract class AbstractHttpClient
supportedCookieSpecs = cookieSpecRegistry;
}
-
+
public synchronized final ConnectionReuseStrategy getConnectionReuseStrategy() {
if (reuseStrategy == null) {
reuseStrategy = createConnectionReuseStrategy();
@@ -363,7 +363,7 @@ public abstract class AbstractHttpClient
this.reuseStrategy = reuseStrategy;
}
-
+
public synchronized final ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy() {
if (keepAliveStrategy == null) {
keepAliveStrategy = createConnectionKeepAliveStrategy();
@@ -371,7 +371,7 @@ public abstract class AbstractHttpClient
return keepAliveStrategy;
}
-
+
public synchronized void setKeepAliveStrategy(final ConnectionKeepAliveStrategy keepAliveStrategy) {
this.keepAliveStrategy = keepAliveStrategy;
}
@@ -485,8 +485,8 @@ public abstract class AbstractHttpClient
public synchronized void setRoutePlanner(final HttpRoutePlanner routePlanner) {
this.routePlanner = routePlanner;
}
-
-
+
+
public synchronized final UserTokenHandler getUserTokenHandler() {
if (this.userTokenHandler == null) {
this.userTokenHandler = createUserTokenHandler();
@@ -498,8 +498,8 @@ public abstract class AbstractHttpClient
public synchronized void setUserTokenHandler(final UserTokenHandler userTokenHandler) {
this.userTokenHandler = userTokenHandler;
}
-
-
+
+
protected synchronized final BasicHttpProcessor getHttpProcessor() {
if (mutableProcessor == null) {
mutableProcessor = createHttpProcessor();
@@ -572,7 +572,7 @@ public abstract class AbstractHttpClient
protocolProcessor = null;
}
-
+
public synchronized void addRequestInterceptor(final HttpRequestInterceptor itcp) {
getHttpProcessor().addInterceptor(itcp);
protocolProcessor = null;
@@ -662,8 +662,8 @@ public abstract class AbstractHttpClient
HttpContext execContext = null;
RequestDirector director = null;
-
- // Initialize the request execution context making copies of
+
+ // Initialize the request execution context making copies of
// all shared objects that are potentially threading unsafe.
synchronized (this) {
@@ -777,15 +777,15 @@ public abstract class AbstractHttpClient
}
public <T> T execute(
- final HttpUriRequest request,
- final ResponseHandler<? extends T> responseHandler)
+ final HttpUriRequest request,
+ final ResponseHandler<? extends T> responseHandler)
throws IOException, ClientProtocolException {
return execute(request, responseHandler, null);
}
public <T> T execute(
final HttpUriRequest request,
- final ResponseHandler<? extends T> responseHandler,
+ final ResponseHandler<? extends T> responseHandler,
final HttpContext context)
throws IOException, ClientProtocolException {
HttpHost target = determineTarget(request);
@@ -793,18 +793,18 @@ public abstract class AbstractHttpClient
}
public <T> T execute(
- final HttpHost target,
+ final HttpHost target,
final HttpRequest request,
- final ResponseHandler<? extends T> responseHandler)
+ final ResponseHandler<? extends T> responseHandler)
throws IOException, ClientProtocolException {
return execute(target, request, responseHandler, null);
}
public <T> T execute(
- final HttpHost target,
+ final HttpHost target,
final HttpRequest request,
- final ResponseHandler<? extends T> responseHandler,
- final HttpContext context)
+ final ResponseHandler<? extends T> responseHandler,
+ final HttpContext context)
throws IOException, ClientProtocolException {
if (responseHandler == null) {
throw new IllegalArgumentException
@@ -839,7 +839,7 @@ public abstract class AbstractHttpClient
if (t instanceof IOException) {
throw (IOException) t;
}
-
+
throw new UndeclaredThrowableException(t);
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicAuthCache.java Fri Apr 23 19:19:23 2010
@@ -35,7 +35,7 @@ import org.apache.http.client.AuthCache;
/**
* Default implementation of {@link AuthCache}.
- *
+ *
* @since 4.0
*/
@NotThreadSafe
@@ -64,7 +64,7 @@ public class BasicAuthCache implements A
}
return this.map.get(host);
}
-
+
public void remove(final HttpHost host) {
if (host == null) {
throw new IllegalArgumentException("HTTP host may not be null");
@@ -75,10 +75,10 @@ public class BasicAuthCache implements A
public void clear() {
this.map.clear();
}
-
+
@Override
public String toString() {
return this.map.toString();
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCookieStore.java Fri Apr 23 19:19:23 2010
@@ -43,8 +43,8 @@ import org.apache.http.cookie.CookieIden
/**
* Default implementation of {@link CookieStore}
- *
- *
+ *
+ *
* @since 4.0
*/
@ThreadSafe
@@ -57,7 +57,7 @@ public class BasicCookieStore implements
@GuardedBy("this")
private final Comparator<Cookie> cookieComparator;
-
+
// -------------------------------------------------------- Class Variables
/**
@@ -71,13 +71,13 @@ public class BasicCookieStore implements
/**
* Adds an {@link Cookie HTTP cookie}, replacing any existing equivalent cookies.
- * If the given cookie has already expired it will not be added, but existing
+ * If the given cookie has already expired it will not be added, but existing
* values will still be removed.
- *
+ *
* @param cookie the {@link Cookie cookie} to be added
- *
+ *
* @see #addCookies(Cookie[])
- *
+ *
*/
public synchronized void addCookie(Cookie cookie) {
if (cookie != null) {
@@ -95,14 +95,14 @@ public class BasicCookieStore implements
}
/**
- * Adds an array of {@link Cookie HTTP cookies}. Cookies are added individually and
- * in the given array order. If any of the given cookies has already expired it will
+ * Adds an array of {@link Cookie HTTP cookies}. Cookies are added individually and
+ * in the given array order. If any of the given cookies has already expired it will
* not be added, but existing values will still be removed.
- *
+ *
* @param cookies the {@link Cookie cookies} to be added
- *
+ *
* @see #addCookie(Cookie)
- *
+ *
*/
public synchronized void addCookies(Cookie[] cookies) {
if (cookies != null) {
@@ -115,7 +115,7 @@ public class BasicCookieStore implements
/**
* Returns an immutable array of {@link Cookie cookies} that this HTTP
* state currently contains.
- *
+ *
* @return an array of {@link Cookie cookies}.
*/
public synchronized List<Cookie> getCookies() {
@@ -124,10 +124,10 @@ public class BasicCookieStore implements
/**
* Removes all of {@link Cookie cookies} in this HTTP state
- * that have expired by the specified {@link java.util.Date date}.
- *
+ * that have expired by the specified {@link java.util.Date date}.
+ *
* @return true if any cookies were purged.
- *
+ *
* @see Cookie#isExpired(Date)
*/
public synchronized boolean clearExpired(final Date date) {
@@ -148,12 +148,12 @@ public class BasicCookieStore implements
public String toString() {
return cookies.toString();
}
-
+
/**
* Clears all cookies.
*/
public synchronized void clear() {
cookies.clear();
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicCredentialsProvider.java Fri Apr 23 19:19:23 2010
@@ -37,7 +37,7 @@ import org.apache.http.client.Credential
/**
* Default implementation of {@link CredentialsProvider}.
- *
+ *
* @since 4.0
*/
@ThreadSafe
@@ -54,7 +54,7 @@ public class BasicCredentialsProvider im
}
public void setCredentials(
- final AuthScope authscope,
+ final AuthScope authscope,
final Credentials credentials) {
if (authscope == null) {
throw new IllegalArgumentException("Authentication scope may not be null");
@@ -67,11 +67,11 @@ public class BasicCredentialsProvider im
*
* @param map the credentials hash map
* @param authscope the {@link AuthScope authentication scope}
- * @return the credentials
- *
+ * @return the credentials
+ *
*/
private static Credentials matchCredentials(
- final Map<AuthScope, Credentials> map,
+ final Map<AuthScope, Credentials> map,
final AuthScope authscope) {
// see if we get a direct hit
Credentials creds = map.get(authscope);
@@ -93,7 +93,7 @@ public class BasicCredentialsProvider im
}
return creds;
}
-
+
public Credentials getCredentials(final AuthScope authscope) {
if (authscope == null) {
throw new IllegalArgumentException("Authentication scope may not be null");
@@ -104,10 +104,10 @@ public class BasicCredentialsProvider im
public void clear() {
this.credMap.clear();
}
-
+
@Override
public String toString() {
return credMap.toString();
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/BasicResponseHandler.java Fri Apr 23 19:19:23 2010
@@ -42,13 +42,13 @@ import org.apache.http.util.EntityUtils;
* A {@link ResponseHandler} that returns the response body as a String
* for successful (2xx) responses. If the response code was >= 300, the response
* body is consumed and an {@link HttpResponseException} is thrown.
- *
+ *
* If this is used with
* {@link org.apache.http.client.HttpClient#execute(
* org.apache.http.client.methods.HttpUriRequest, ResponseHandler)},
* HttpClient may handle redirects (3xx responses) internally.
- *
- *
+ *
+ *
* @since 4.0
*/
@Immutable
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ContentEncodingHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ContentEncodingHttpClient.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ContentEncodingHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ContentEncodingHttpClient.java Fri Apr 23 19:19:23 2010
@@ -33,9 +33,9 @@ import org.apache.http.params.HttpParams
import org.apache.http.protocol.BasicHttpProcessor;
/**
- * {@link DefaultHttpClient} sub-class which includes a {@link RequestAcceptEncoding}
+ * {@link DefaultHttpClient} sub-class which includes a {@link RequestAcceptEncoding}
* for the request and response.
- *
+ *
* @since 4.1
*/
public class ContentEncodingHttpClient extends DefaultHttpClient {
@@ -58,7 +58,7 @@ public class ContentEncodingHttpClient e
}
/**
- *
+ *
*/
public ContentEncodingHttpClient() {
this(null);
@@ -70,11 +70,11 @@ public class ContentEncodingHttpClient e
@Override
protected BasicHttpProcessor createHttpProcessor() {
BasicHttpProcessor result = super.createHttpProcessor();
-
+
result.addRequestInterceptor(new RequestAcceptEncoding());
result.addResponseInterceptor(new ResponseContentEncoding());
-
+
return result;
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java Fri Apr 23 19:19:23 2010
@@ -39,15 +39,15 @@ import org.apache.http.protocol.HttpCont
/**
* Default implementation of a strategy deciding duration
* that a connection can remain idle.
- *
+ *
* The default implementation looks solely at the 'Keep-Alive'
* header's timeout token.
- *
+ *
* @since 4.0
*/
@Immutable
public class DefaultConnectionKeepAliveStrategy implements ConnectionKeepAliveStrategy {
-
+
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -56,7 +56,7 @@ public class DefaultConnectionKeepAliveS
response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
HeaderElement he = it.nextElement();
- String param = he.getName();
+ String param = he.getName();
String value = he.getValue();
if (value != null && param.equalsIgnoreCase("timeout")) {
try {
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java Fri Apr 23 19:19:23 2010
@@ -89,7 +89,7 @@ import org.apache.http.util.VersionInfo;
* This class creates an instance of {@link SingleClientConnManager}
* for connection management if not explicitly set.
* <p>
- * This class creates the following chain of protocol interceptors per
+ * This class creates the following chain of protocol interceptors per
* default:
* <ul>
* <li>{@link RequestDefaultHeaders}</li>
@@ -114,8 +114,8 @@ import org.apache.http.util.VersionInfo;
* <li>UserAgent: Apache-HttpClient/release (java 1.5)</li>
* </ul>
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#PROTOCOL_VERSION}</li>
* <li>{@link org.apache.http.params.CoreProtocolPNames#STRICT_TRANSFER_ENCODING}</li>
@@ -167,8 +167,8 @@ public class DefaultHttpClient extends A
super(conman, params);
setRedirectStrategy(new DefaultRedirectStrategy());
}
-
-
+
+
/**
* @since 4.1
*/
@@ -176,28 +176,28 @@ public class DefaultHttpClient extends A
final ClientConnectionManager conman) {
super(conman, null);
}
-
-
+
+
public DefaultHttpClient(final HttpParams params) {
super(null, params);
}
-
+
public DefaultHttpClient() {
super(null, null);
}
-
+
@Override
protected HttpParams createHttpParams() {
HttpParams params = new SyncBasicHttpParams();
- HttpProtocolParams.setVersion(params,
+ HttpProtocolParams.setVersion(params,
HttpVersion.HTTP_1_1);
- HttpProtocolParams.setContentCharset(params,
+ HttpProtocolParams.setContentCharset(params,
HTTP.DEFAULT_CONTENT_CHARSET);
- HttpConnectionParams.setTcpNoDelay(params,
+ HttpConnectionParams.setTcpNoDelay(params,
true);
- HttpConnectionParams.setSocketBufferSize(params,
+ HttpConnectionParams.setSocketBufferSize(params,
8192);
// determine the release version from packaged version info
@@ -205,13 +205,13 @@ public class DefaultHttpClient extends A
("org.apache.http.client", getClass().getClassLoader());
final String release = (vi != null) ?
vi.getRelease() : VersionInfo.UNAVAILABLE;
- HttpProtocolParams.setUserAgent(params,
+ HttpProtocolParams.setUserAgent(params,
"Apache-HttpClient/" + release + " (java 1.5)");
return params;
}
-
+
@Override
protected HttpRequestExecutor createRequestExecutor() {
return new HttpRequestExecutor();
@@ -226,9 +226,9 @@ public class DefaultHttpClient extends A
registry.register(
new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
- ClientConnectionManager connManager = null;
+ ClientConnectionManager connManager = null;
HttpParams params = getParams();
-
+
ClientConnectionManagerFactory factory = null;
String className = (String) params.getParameter(
@@ -248,9 +248,9 @@ public class DefaultHttpClient extends A
if (factory != null) {
connManager = factory.newInstance(params, registry);
} else {
- connManager = new SingleClientConnManager(registry);
+ connManager = new SingleClientConnManager(registry);
}
-
+
return connManager;
}
@@ -259,43 +259,43 @@ public class DefaultHttpClient extends A
protected HttpContext createHttpContext() {
HttpContext context = new BasicHttpContext();
context.setAttribute(
- ClientContext.SCHEME_REGISTRY,
+ ClientContext.SCHEME_REGISTRY,
getConnectionManager().getSchemeRegistry());
context.setAttribute(
- ClientContext.AUTHSCHEME_REGISTRY,
+ ClientContext.AUTHSCHEME_REGISTRY,
getAuthSchemes());
context.setAttribute(
- ClientContext.COOKIESPEC_REGISTRY,
+ ClientContext.COOKIESPEC_REGISTRY,
getCookieSpecs());
context.setAttribute(
- ClientContext.COOKIE_STORE,
+ ClientContext.COOKIE_STORE,
getCookieStore());
context.setAttribute(
- ClientContext.CREDS_PROVIDER,
+ ClientContext.CREDS_PROVIDER,
getCredentialsProvider());
return context;
}
-
+
@Override
protected ConnectionReuseStrategy createConnectionReuseStrategy() {
return new DefaultConnectionReuseStrategy();
}
-
+
@Override
protected ConnectionKeepAliveStrategy createConnectionKeepAliveStrategy() {
return new DefaultConnectionKeepAliveStrategy();
}
-
+
@Override
protected AuthSchemeRegistry createAuthSchemeRegistry() {
- AuthSchemeRegistry registry = new AuthSchemeRegistry();
+ AuthSchemeRegistry registry = new AuthSchemeRegistry();
registry.register(
- AuthPolicy.BASIC,
+ AuthPolicy.BASIC,
new BasicSchemeFactory());
registry.register(
- AuthPolicy.DIGEST,
+ AuthPolicy.DIGEST,
new DigestSchemeFactory());
return registry;
}
@@ -305,19 +305,19 @@ public class DefaultHttpClient extends A
protected CookieSpecRegistry createCookieSpecRegistry() {
CookieSpecRegistry registry = new CookieSpecRegistry();
registry.register(
- CookiePolicy.BEST_MATCH,
+ CookiePolicy.BEST_MATCH,
new BestMatchSpecFactory());
registry.register(
- CookiePolicy.BROWSER_COMPATIBILITY,
+ CookiePolicy.BROWSER_COMPATIBILITY,
new BrowserCompatSpecFactory());
registry.register(
- CookiePolicy.NETSCAPE,
+ CookiePolicy.NETSCAPE,
new NetscapeDraftSpecFactory());
registry.register(
- CookiePolicy.RFC_2109,
+ CookiePolicy.RFC_2109,
new RFC2109SpecFactory());
registry.register(
- CookiePolicy.RFC_2965,
+ CookiePolicy.RFC_2965,
new RFC2965SpecFactory());
return registry;
}
@@ -393,5 +393,5 @@ public class DefaultHttpClient extends A
protected UserTokenHandler createUserTokenHandler() {
return new DefaultUserTokenHandler();
}
-
+
} // class DefaultHttpClient
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java Fri Apr 23 19:19:23 2010
@@ -45,7 +45,7 @@ import org.apache.http.protocol.Executio
/**
* The default {@link HttpRequestRetryHandler} used by request executors.
- *
+ *
*
* @since 4.0
*/
@@ -54,10 +54,10 @@ public class DefaultHttpRequestRetryHand
/** the number of times a method will be retried */
private final int retryCount;
-
+
/** Whether or not methods that have successfully sent their request will be retried */
private final boolean requestSentRetryEnabled;
-
+
/**
* Default constructor
*/
@@ -66,19 +66,19 @@ public class DefaultHttpRequestRetryHand
this.retryCount = retryCount;
this.requestSentRetryEnabled = requestSentRetryEnabled;
}
-
+
/**
* Default constructor
*/
public DefaultHttpRequestRetryHandler() {
this(3, false);
}
- /**
+ /**
* Used <code>retryCount</code> and <code>requestSentRetryEnabled</code> to determine
* if the given method should be retried.
*/
public boolean retryRequest(
- final IOException exception,
+ final IOException exception,
int executionCount,
final HttpContext context) {
if (exception == null) {
@@ -104,26 +104,26 @@ public class DefaultHttpRequestRetryHand
return false;
}
if (exception instanceof ConnectException) {
- // Connection refused
+ // Connection refused
return false;
}
if (exception instanceof SSLException) {
// SSL handshake exception
return false;
}
-
+
HttpRequest request = (HttpRequest)
context.getAttribute(ExecutionContext.HTTP_REQUEST);
- boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
+ boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
if (idempotent) {
- // Retry if the request is considered idempotent
+ // Retry if the request is considered idempotent
return true;
}
-
+
Boolean b = (Boolean)
context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
boolean sent = (b != null && b.booleanValue());
-
+
if (!sent || this.requestSentRetryEnabled) {
// Retry if the request has not been sent fully or
// if it's OK to retry methods that have been sent
@@ -132,9 +132,9 @@ public class DefaultHttpRequestRetryHand
// otherwise do not retry
return false;
}
-
+
/**
- * @return <code>true</code> if this handler will retry methods that have
+ * @return <code>true</code> if this handler will retry methods that have
* successfully sent their request, <code>false</code> otherwise
*/
public boolean isRequestSentRetryEnabled() {
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultProxyAuthenticationHandler.java Fri Apr 23 19:19:23 2010
@@ -42,20 +42,20 @@ import org.apache.http.client.Authentica
import org.apache.http.protocol.HttpContext;
/**
- * Default {@link AuthenticationHandler} implementation for proxy host
+ * Default {@link AuthenticationHandler} implementation for proxy host
* authentication.
*
* @since 4.0
*/
-@Immutable
+@Immutable
public class DefaultProxyAuthenticationHandler extends AbstractAuthenticationHandler {
public DefaultProxyAuthenticationHandler() {
super();
}
-
+
public boolean isAuthenticationRequested(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -65,7 +65,7 @@ public class DefaultProxyAuthenticationH
}
public Map<String, Header> getChallenges(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws MalformedChallengeException {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -76,7 +76,7 @@ public class DefaultProxyAuthenticationH
@Override
protected List<String> getAuthPreferences(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) {
@SuppressWarnings("unchecked")
List<String> authpref = (List<String>) response.getParams().getParameter(
@@ -87,5 +87,5 @@ public class DefaultProxyAuthenticationH
return super.getAuthPreferences(response, context);
}
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectHandler.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectHandler.java Fri Apr 23 19:19:23 2010
@@ -54,7 +54,7 @@ import org.apache.http.protocol.Executio
* Default implementation of {@link RedirectHandler}.
*
* @since 4.0
- *
+ *
* @deprecated use {@link DefaultRedirectStrategy}.
*/
@Immutable
@@ -62,20 +62,20 @@ import org.apache.http.protocol.Executio
public class DefaultRedirectHandler implements RedirectHandler {
private final Log log = LogFactory.getLog(getClass());
-
+
private static final String REDIRECT_LOCATIONS = "http.protocol.redirect-locations";
public DefaultRedirectHandler() {
super();
}
-
+
public boolean isRedirectRequested(
final HttpResponse response,
final HttpContext context) {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
-
+
int statusCode = response.getStatusLine().getStatusCode();
switch (statusCode) {
case HttpStatus.SC_MOVED_TEMPORARILY:
@@ -84,7 +84,7 @@ public class DefaultRedirectHandler impl
HttpRequest request = (HttpRequest) context.getAttribute(
ExecutionContext.HTTP_REQUEST);
String method = request.getRequestLine().getMethod();
- return method.equalsIgnoreCase(HttpGet.METHOD_NAME)
+ return method.equalsIgnoreCase(HttpGet.METHOD_NAME)
|| method.equalsIgnoreCase(HttpHead.METHOD_NAME);
case HttpStatus.SC_SEE_OTHER:
return true;
@@ -92,9 +92,9 @@ public class DefaultRedirectHandler impl
return false;
} //end of switch
}
-
+
public URI getLocationURI(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws ProtocolException {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -114,7 +114,7 @@ public class DefaultRedirectHandler impl
URI uri;
try {
- uri = new URI(location);
+ uri = new URI(location);
} catch (URISyntaxException ex) {
throw new ProtocolException("Invalid redirect URI: " + location, ex);
}
@@ -124,7 +124,7 @@ public class DefaultRedirectHandler impl
// Location = "Location" ":" absoluteURI
if (!uri.isAbsolute()) {
if (params.isParameterTrue(ClientPNames.REJECT_RELATIVE_REDIRECT)) {
- throw new ProtocolException("Relative redirect location '"
+ throw new ProtocolException("Relative redirect location '"
+ uri + "' not allowed");
}
// Adjust location URI
@@ -134,34 +134,34 @@ public class DefaultRedirectHandler impl
throw new IllegalStateException("Target host not available " +
"in the HTTP context");
}
-
+
HttpRequest request = (HttpRequest) context.getAttribute(
ExecutionContext.HTTP_REQUEST);
-
+
try {
URI requestURI = new URI(request.getRequestLine().getUri());
URI absoluteRequestURI = URIUtils.rewriteURI(requestURI, target, true);
- uri = URIUtils.resolve(absoluteRequestURI, uri);
+ uri = URIUtils.resolve(absoluteRequestURI, uri);
} catch (URISyntaxException ex) {
throw new ProtocolException(ex.getMessage(), ex);
}
}
-
+
if (params.isParameterFalse(ClientPNames.ALLOW_CIRCULAR_REDIRECTS)) {
-
+
RedirectLocations redirectLocations = (RedirectLocations) context.getAttribute(
REDIRECT_LOCATIONS);
-
+
if (redirectLocations == null) {
redirectLocations = new RedirectLocations();
context.setAttribute(REDIRECT_LOCATIONS, redirectLocations);
}
-
+
URI redirectURI;
if (uri.getFragment() != null) {
try {
HttpHost target = new HttpHost(
- uri.getHost(),
+ uri.getHost(),
uri.getPort(),
uri.getScheme());
redirectURI = URIUtils.rewriteURI(uri, target, true);
@@ -171,7 +171,7 @@ public class DefaultRedirectHandler impl
} else {
redirectURI = uri;
}
-
+
if (redirectLocations.contains(redirectURI)) {
throw new CircularRedirectException("Circular redirect to '" +
redirectURI + "'");
@@ -179,7 +179,7 @@ public class DefaultRedirectHandler impl
redirectLocations.add(redirectURI);
}
}
-
+
return uri;
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategy.java Fri Apr 23 19:19:23 2010
@@ -60,28 +60,28 @@ import org.apache.http.protocol.Executio
public class DefaultRedirectStrategy implements RedirectStrategy {
private final Log log = LogFactory.getLog(getClass());
-
+
public static final String REDIRECT_LOCATIONS = "http.protocol.redirect-locations";
public DefaultRedirectStrategy() {
super();
}
-
+
public boolean isRedirected(
final HttpRequest request,
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws ProtocolException {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
}
-
+
int statusCode = response.getStatusLine().getStatusCode();
switch (statusCode) {
case HttpStatus.SC_MOVED_TEMPORARILY:
case HttpStatus.SC_MOVED_PERMANENTLY:
case HttpStatus.SC_TEMPORARY_REDIRECT:
String method = request.getRequestLine().getMethod();
- return method.equalsIgnoreCase(HttpGet.METHOD_NAME)
+ return method.equalsIgnoreCase(HttpGet.METHOD_NAME)
|| method.equalsIgnoreCase(HttpHead.METHOD_NAME);
case HttpStatus.SC_SEE_OTHER:
return true;
@@ -89,10 +89,10 @@ public class DefaultRedirectStrategy imp
return false;
} //end of switch
}
-
+
public URI getLocationURI(
final HttpRequest request,
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws ProtocolException {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -117,7 +117,7 @@ public class DefaultRedirectStrategy imp
// Location = "Location" ":" absoluteURI
if (!uri.isAbsolute()) {
if (params.isParameterTrue(ClientPNames.REJECT_RELATIVE_REDIRECT)) {
- throw new ProtocolException("Relative redirect location '"
+ throw new ProtocolException("Relative redirect location '"
+ uri + "' not allowed");
}
// Adjust location URI
@@ -130,27 +130,27 @@ public class DefaultRedirectStrategy imp
try {
URI requestURI = new URI(request.getRequestLine().getUri());
URI absoluteRequestURI = URIUtils.rewriteURI(requestURI, target, true);
- uri = URIUtils.resolve(absoluteRequestURI, uri);
+ uri = URIUtils.resolve(absoluteRequestURI, uri);
} catch (URISyntaxException ex) {
throw new ProtocolException(ex.getMessage(), ex);
}
}
-
+
if (params.isParameterFalse(ClientPNames.ALLOW_CIRCULAR_REDIRECTS)) {
-
+
RedirectLocations redirectLocations = (RedirectLocations) context.getAttribute(
REDIRECT_LOCATIONS);
-
+
if (redirectLocations == null) {
redirectLocations = new RedirectLocations();
context.setAttribute(REDIRECT_LOCATIONS, redirectLocations);
}
-
+
URI redirectURI;
if (uri.getFragment() != null) {
try {
HttpHost target = new HttpHost(
- uri.getHost(),
+ uri.getHost(),
uri.getPort(),
uri.getScheme());
redirectURI = URIUtils.rewriteURI(uri, target, true);
@@ -160,7 +160,7 @@ public class DefaultRedirectStrategy imp
} else {
redirectURI = uri;
}
-
+
if (redirectLocations.contains(redirectURI)) {
throw new CircularRedirectException("Circular redirect to '" +
redirectURI + "'");
@@ -168,10 +168,10 @@ public class DefaultRedirectStrategy imp
redirectLocations.add(redirectURI);
}
}
-
+
return uri;
}
-
+
/**
* @since 4.1
*/
@@ -185,7 +185,7 @@ public class DefaultRedirectStrategy imp
public HttpUriRequest getRedirect(
final HttpRequest request,
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws ProtocolException {
URI uri = getLocationURI(request, response, context);
String method = request.getRequestLine().getMethod();
@@ -195,5 +195,5 @@ public class DefaultRedirectStrategy imp
return new HttpGet(uri);
}
}
-
+
}
\ No newline at end of file
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java Fri Apr 23 19:19:23 2010
@@ -47,23 +47,23 @@ import org.apache.http.protocol.HttpCont
class DefaultRedirectStrategyAdaptor implements RedirectStrategy {
private final org.apache.http.client.RedirectHandler handler;
-
+
@Deprecated
public DefaultRedirectStrategyAdaptor(final org.apache.http.client.RedirectHandler handler) {
super();
this.handler = handler;
}
-
+
public boolean isRedirected(
final HttpRequest request,
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws ProtocolException {
return this.handler.isRedirectRequested(response, context);
}
-
+
public HttpUriRequest getRedirect(
final HttpRequest request,
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws ProtocolException {
URI uri = this.handler.getLocationURI(response, context);
String method = request.getRequestLine().getMethod();
@@ -73,5 +73,5 @@ class DefaultRedirectStrategyAdaptor imp
return new HttpGet(uri);
}
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Fri Apr 23 19:19:23 2010
@@ -94,8 +94,8 @@ import org.apache.http.protocol.HttpRequ
/**
* Default implementation of {@link RequestDirector}.
* <p>
- * The following parameters can be used to customize the behavior of this
- * class:
+ * The following parameters can be used to customize the behavior of this
+ * class:
* <ul>
* <li>{@link org.apache.http.params.CoreProtocolPNames#PROTOCOL_VERSION}</li>
* <li>{@link org.apache.http.params.CoreProtocolPNames#STRICT_TRANSFER_ENCODING}</li>
@@ -135,7 +135,7 @@ import org.apache.http.protocol.HttpRequ
public class DefaultRequestDirector implements RequestDirector {
private final Log log;
-
+
/** The connection manager. */
protected final ClientConnectionManager connManager;
@@ -144,7 +144,7 @@ public class DefaultRequestDirector impl
/** The connection re-use strategy. */
protected final ConnectionReuseStrategy reuseStrategy;
-
+
/** The keep-alive duration strategy. */
protected final ConnectionKeepAliveStrategy keepAliveStrategy;
@@ -153,42 +153,42 @@ public class DefaultRequestDirector impl
/** The HTTP protocol processor. */
protected final HttpProcessor httpProcessor;
-
+
/** The request retry handler. */
protected final HttpRequestRetryHandler retryHandler;
-
+
/** The redirect handler. */
@Deprecated
protected final org.apache.http.client.RedirectHandler redirectHandler = null;
-
+
/** The redirect strategy. */
protected final RedirectStrategy redirectStrategy;
-
+
/** The target authentication handler. */
protected final AuthenticationHandler targetAuthHandler;
-
+
/** The proxy authentication handler. */
protected final AuthenticationHandler proxyAuthHandler;
-
+
/** The user token handler. */
protected final UserTokenHandler userTokenHandler;
-
+
/** The HTTP parameters. */
protected final HttpParams params;
-
+
/** The currently allocated connection. */
protected ManagedClientConnection managedConn;
protected final AuthState targetAuthState;
-
+
protected final AuthState proxyAuthState;
private int execCount;
-
+
private int redirectCount;
private int maxRedirects;
-
+
private HttpHost virtualHost;
@Deprecated
@@ -207,11 +207,11 @@ public class DefaultRequestDirector impl
final HttpParams params) {
this(LogFactory.getLog(DefaultRequestDirector.class),
requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler,
- new DefaultRedirectStrategyAdaptor(redirectHandler),
+ new DefaultRedirectStrategyAdaptor(redirectHandler),
targetAuthHandler, proxyAuthHandler, userTokenHandler, params);
- }
-
-
+ }
+
+
/**
* @since 4.1
*/
@@ -293,11 +293,11 @@ public class DefaultRequestDirector impl
this.redirectStrategy = redirectStrategy;
this.targetAuthHandler = targetAuthHandler;
this.proxyAuthHandler = proxyAuthHandler;
- this.userTokenHandler = userTokenHandler;
+ this.userTokenHandler = userTokenHandler;
this.params = params;
this.managedConn = null;
-
+
this.execCount = 0;
this.redirectCount = 0;
this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100);
@@ -316,13 +316,13 @@ public class DefaultRequestDirector impl
request);
}
}
-
-
+
+
protected void rewriteRequestURI(
final RequestWrapper request,
final HttpRoute route) throws ProtocolException {
try {
-
+
URI uri = request.getURI();
if (route.getProxyHost() != null && !route.isTunnelled()) {
// Make sure the request URI is absolute
@@ -338,14 +338,14 @@ public class DefaultRequestDirector impl
request.setURI(uri);
}
}
-
+
} catch (URISyntaxException ex) {
- throw new ProtocolException("Invalid URI: " +
+ throw new ProtocolException("Invalid URI: " +
request.getRequestLine().getUri(), ex);
}
}
-
-
+
+
// non-javadoc, see interface ClientRequestDirector
public HttpResponse execute(HttpHost target, HttpRequest request,
HttpContext context)
@@ -358,11 +358,11 @@ public class DefaultRequestDirector impl
virtualHost = (HttpHost) orig.getParams().getParameter(
ClientPNames.VIRTUAL_HOST);
-
- RoutedRequest roureq = new RoutedRequest(origWrapper, origRoute);
+
+ RoutedRequest roureq = new RoutedRequest(origWrapper, origRoute);
long timeout = ConnManagerParams.getTimeout(params);
-
+
boolean reuse = false;
boolean done = false;
try {
@@ -376,10 +376,10 @@ public class DefaultRequestDirector impl
RequestWrapper wrapper = roureq.getRequest();
HttpRoute route = roureq.getRoute();
response = null;
-
+
// See if we have a user token bound to the execution context
Object userToken = context.getAttribute(ClientContext.USER_TOKEN);
-
+
// Allocate connection if needed
if (managedConn == null) {
ClientConnectionRequest connRequest = connManager.requestConnection(
@@ -387,7 +387,7 @@ public class DefaultRequestDirector impl
if (orig instanceof AbortableHttpRequest) {
((AbortableHttpRequest) orig).setConnectionRequest(connRequest);
}
-
+
try {
managedConn = connRequest.getConnection(timeout, TimeUnit.MILLISECONDS);
} catch(InterruptedException interrupted) {
@@ -424,7 +424,7 @@ public class DefaultRequestDirector impl
// Reset headers on the request wrapper
wrapper.resetHeaders();
-
+
// Re-write request URI if needed
rewriteRequestURI(wrapper, route);
@@ -451,7 +451,7 @@ public class DefaultRequestDirector impl
// Run request protocol interceptors
requestExec.preProcess(wrapper, httpProcessor, context);
-
+
response = tryExecute(roureq, context);
if (response == null) {
// Need to start over
@@ -461,7 +461,7 @@ public class DefaultRequestDirector impl
// Run response protocol interceptors
response.setParams(params);
requestExec.postProcess(response, httpProcessor, context);
-
+
// The connection is in or can be brought to a re-usable state.
reuse = reuseStrategy.keepAlive(response, context);
@@ -478,7 +478,7 @@ public class DefaultRequestDirector impl
}
}
}
-
+
RoutedRequest followup = handleResponse(roureq, response, context);
if (followup == null) {
done = true;
@@ -509,7 +509,7 @@ public class DefaultRequestDirector impl
managedConn.setState(userToken);
}
}
-
+
} // while not done
@@ -528,7 +528,7 @@ public class DefaultRequestDirector impl
}
return response;
-
+
} catch (ConnectionShutdownException ex) {
InterruptedIOException ioex = new InterruptedIOException(
"Connection has been shut down");
@@ -547,13 +547,13 @@ public class DefaultRequestDirector impl
} // execute
/**
- * Establish connection either directly or through a tunnel and retry in case of
+ * Establish connection either directly or through a tunnel and retry in case of
* a recoverable I/O failure
*/
private void tryConnect(
final RoutedRequest req, final HttpContext context) throws HttpException, IOException {
HttpRoute route = req.getRoute();
-
+
boolean retrying = true;
while (retrying) {
// Increment total exec count
@@ -565,7 +565,7 @@ public class DefaultRequestDirector impl
managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params));
}
establishRoute(route, context);
- retrying = false;
+ retrying = false;
} catch (IOException ex) {
try {
managedConn.close();
@@ -573,7 +573,7 @@ public class DefaultRequestDirector impl
}
if (retryHandler.retryRequest(ex, execCount, context)) {
if (this.log.isInfoEnabled()) {
- this.log.info("I/O exception ("+ ex.getClass().getName() +
+ this.log.info("I/O exception ("+ ex.getClass().getName() +
") caught when connecting to the target host: "
+ ex.getMessage());
}
@@ -585,9 +585,9 @@ public class DefaultRequestDirector impl
throw ex;
}
}
- }
+ }
}
-
+
/**
* Execute request and retry in case of a recoverable I/O failure
*/
@@ -596,7 +596,7 @@ public class DefaultRequestDirector impl
RequestWrapper wrapper = req.getRequest();
HttpRoute route = req.getRoute();
HttpResponse response = null;
-
+
boolean retrying = true;
Exception retryReason = null;
while (retrying) {
@@ -615,14 +615,14 @@ public class DefaultRequestDirector impl
"with a non-repeatable request entity.");
}
}
-
+
try {
if (this.log.isDebugEnabled()) {
this.log.debug("Attempt " + execCount + " to execute request");
}
response = requestExec.execute(wrapper, managedConn, context);
retrying = false;
-
+
} catch (IOException ex) {
this.log.debug("Closing the connection.");
try {
@@ -631,7 +631,7 @@ public class DefaultRequestDirector impl
}
if (retryHandler.retryRequest(ex, execCount, context)) {
if (this.log.isInfoEnabled()) {
- this.log.info("I/O exception ("+ ex.getClass().getName() +
+ this.log.info("I/O exception ("+ ex.getClass().getName() +
") caught when processing request: "
+ ex.getMessage());
}
@@ -654,12 +654,12 @@ public class DefaultRequestDirector impl
this.log.debug("Proxied connection. Need to start over.");
retrying = false;
}
-
+
}
}
return response;
}
-
+
/**
* Returns the connection back to the connection manager
* and prepares for retrieving a new connection during
@@ -806,19 +806,19 @@ public class DefaultRequestDirector impl
HttpHost proxy = route.getProxyHost();
HttpHost target = route.getTargetHost();
HttpResponse response = null;
-
+
boolean done = false;
while (!done) {
done = true;
-
+
if (!this.managedConn.isOpen()) {
this.managedConn.open(route, context, this.params);
}
-
+
HttpRequest connect = createConnectRequest(route, context);
connect.setParams(this.params);
-
+
// Populate the execution context
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST,
target);
@@ -832,23 +832,23 @@ public class DefaultRequestDirector impl
proxyAuthState);
context.setAttribute(ExecutionContext.HTTP_REQUEST,
connect);
-
+
this.requestExec.preProcess(connect, this.httpProcessor, context);
-
+
response = this.requestExec.execute(connect, this.managedConn, context);
-
+
response.setParams(this.params);
this.requestExec.postProcess(response, this.httpProcessor, context);
-
+
int status = response.getStatusLine().getStatusCode();
if (status < 200) {
throw new HttpException("Unexpected response to CONNECT request: " +
response.getStatusLine());
}
-
+
CredentialsProvider credsProvider = (CredentialsProvider)
context.getAttribute(ClientContext.CREDS_PROVIDER);
-
+
if (credsProvider != null && HttpClientParams.isAuthenticating(params)) {
if (this.proxyAuthHandler.isAuthenticationRequested(response, context)) {
@@ -857,7 +857,7 @@ public class DefaultRequestDirector impl
response, context);
try {
processChallenges(
- challenges, this.proxyAuthState, this.proxyAuthHandler,
+ challenges, this.proxyAuthState, this.proxyAuthHandler,
response, context);
} catch (AuthenticationException ex) {
if (this.log.isWarnEnabled()) {
@@ -866,7 +866,7 @@ public class DefaultRequestDirector impl
}
}
updateAuthState(this.proxyAuthState, proxy, credsProvider);
-
+
if (this.proxyAuthState.getCredentials() != null) {
done = false;
@@ -877,13 +877,13 @@ public class DefaultRequestDirector impl
HttpEntity entity = response.getEntity();
if (entity != null) {
entity.consumeContent();
- }
+ }
} else {
this.managedConn.close();
}
-
+
}
-
+
} else {
// Reset proxy auth scope
this.proxyAuthState.setAuthScope(null);
@@ -899,15 +899,15 @@ public class DefaultRequestDirector impl
HttpEntity entity = response.getEntity();
if (entity != null) {
response.setEntity(new BufferedHttpEntity(entity));
- }
-
+ }
+
this.managedConn.close();
throw new TunnelRefusedException("CONNECT refused by proxy: " +
response.getStatusLine(), response);
}
this.managedConn.markReusable();
-
+
// How to decide on security of the tunnelled connection?
// The socket factory knows only about the segment to the proxy.
// Even if that is secure, the hop to the target may be insecure.
@@ -965,12 +965,12 @@ public class DefaultRequestDirector impl
*/
protected HttpRequest createConnectRequest(HttpRoute route,
HttpContext context) {
- // see RFC 2817, section 5.2 and
- // INTERNET-DRAFT: Tunneling TCP based protocols through
+ // see RFC 2817, section 5.2 and
+ // INTERNET-DRAFT: Tunneling TCP based protocols through
// Web proxy servers
-
+
HttpHost target = route.getTargetHost();
-
+
String host = target.getHostName();
int port = target.getPort();
if (port < 0) {
@@ -978,12 +978,12 @@ public class DefaultRequestDirector impl
getScheme(target.getSchemeName());
port = scheme.getDefaultPort();
}
-
+
StringBuilder buffer = new StringBuilder(host.length() + 6);
buffer.append(host);
buffer.append(':');
buffer.append(Integer.toString(port));
-
+
String authority = buffer.toString();
ProtocolVersion ver = HttpProtocolParams.getVersion(params);
HttpRequest req = new BasicHttpRequest
@@ -996,7 +996,7 @@ public class DefaultRequestDirector impl
/**
* Analyzes a response to check need for a followup.
*
- * @param roureq the request and route.
+ * @param roureq the request and route.
* @param response the response to analayze
* @param context the context used for the current request execution
*
@@ -1013,9 +1013,9 @@ public class DefaultRequestDirector impl
HttpRoute route = roureq.getRoute();
RequestWrapper request = roureq.getRequest();
-
+
HttpParams params = request.getParams();
- if (HttpClientParams.isRedirecting(params) &&
+ if (HttpClientParams.isRedirecting(params) &&
this.redirectStrategy.isRedirected(request, response, context)) {
if (redirectCount >= maxRedirects) {
@@ -1023,28 +1023,28 @@ public class DefaultRequestDirector impl
+ maxRedirects + ") exceeded");
}
redirectCount++;
-
+
// Virtual host cannot be used any longer
virtualHost = null;
-
- HttpUriRequest redirect = redirectStrategy.getRedirect(request, response, context);
+
+ HttpUriRequest redirect = redirectStrategy.getRedirect(request, response, context);
HttpRequest orig = request.getOriginal();
redirect.setHeaders(orig.getAllHeaders());
-
+
URI uri = redirect.getURI();
if (uri.getHost() == null) {
throw new ProtocolException("Redirect URI does not specify a valid host name: " + uri);
}
-
+
HttpHost newTarget = new HttpHost(
- uri.getHost(),
+ uri.getHost(),
uri.getPort(),
uri.getScheme());
-
+
// Unset auth scope
targetAuthState.setAuthScope(null);
proxyAuthState.setAuthScope(null);
-
+
// Invalidate auth states if redirecting to another host
if (!route.getTargetHost().equals(newTarget)) {
targetAuthState.invalidate();
@@ -1056,20 +1056,20 @@ public class DefaultRequestDirector impl
RequestWrapper wrapper = wrapRequest(redirect);
wrapper.setParams(params);
-
+
HttpRoute newRoute = determineRoute(newTarget, wrapper, context);
RoutedRequest newRequest = new RoutedRequest(wrapper, newRoute);
-
+
if (this.log.isDebugEnabled()) {
this.log.debug("Redirecting to '" + uri + "' via " + newRoute);
}
-
+
return newRequest;
}
CredentialsProvider credsProvider = (CredentialsProvider)
context.getAttribute(ClientContext.CREDS_PROVIDER);
-
+
if (credsProvider != null && HttpClientParams.isAuthenticating(params)) {
if (this.targetAuthHandler.isAuthenticationRequested(response, context)) {
@@ -1079,12 +1079,12 @@ public class DefaultRequestDirector impl
if (target == null) {
target = route.getTargetHost();
}
-
+
this.log.debug("Target requested authentication");
Map<String, Header> challenges = this.targetAuthHandler.getChallenges(
- response, context);
+ response, context);
try {
- processChallenges(challenges,
+ processChallenges(challenges,
this.targetAuthState, this.targetAuthHandler,
response, context);
} catch (AuthenticationException ex) {
@@ -1094,7 +1094,7 @@ public class DefaultRequestDirector impl
}
}
updateAuthState(this.targetAuthState, target, credsProvider);
-
+
if (this.targetAuthState.getCredentials() != null) {
// Re-try the same request via the same route
return roureq;
@@ -1105,17 +1105,17 @@ public class DefaultRequestDirector impl
// Reset target auth scope
this.targetAuthState.setAuthScope(null);
}
-
+
if (this.proxyAuthHandler.isAuthenticationRequested(response, context)) {
HttpHost proxy = route.getProxyHost();
-
+
this.log.debug("Proxy requested authentication");
Map<String, Header> challenges = this.proxyAuthHandler.getChallenges(
response, context);
try {
- processChallenges(challenges,
- this.proxyAuthState, this.proxyAuthHandler,
+ processChallenges(challenges,
+ this.proxyAuthState, this.proxyAuthHandler,
response, context);
} catch (AuthenticationException ex) {
if (this.log.isWarnEnabled()) {
@@ -1124,7 +1124,7 @@ public class DefaultRequestDirector impl
}
}
updateAuthState(this.proxyAuthState, proxy, credsProvider);
-
+
if (this.proxyAuthState.getCredentials() != null) {
// Re-try the same request via the same route
return roureq;
@@ -1169,13 +1169,13 @@ public class DefaultRequestDirector impl
private void processChallenges(
- final Map<String, Header> challenges,
+ final Map<String, Header> challenges,
final AuthState authState,
final AuthenticationHandler authHandler,
- final HttpResponse response,
- final HttpContext context)
+ final HttpResponse response,
+ final HttpContext context)
throws MalformedChallengeException, AuthenticationException {
-
+
AuthScheme authScheme = authState.getAuthScheme();
if (authScheme == null) {
// Authentication not attempted before
@@ -1186,37 +1186,37 @@ public class DefaultRequestDirector impl
Header challenge = challenges.get(id.toLowerCase(Locale.ENGLISH));
if (challenge == null) {
- throw new AuthenticationException(id +
+ throw new AuthenticationException(id +
" authorization challenge expected, but not found");
}
authScheme.processChallenge(challenge);
this.log.debug("Authorization challenge processed");
}
-
-
+
+
private void updateAuthState(
- final AuthState authState,
+ final AuthState authState,
final HttpHost host,
final CredentialsProvider credsProvider) {
-
+
if (!authState.isValid()) {
return;
}
-
+
String hostname = host.getHostName();
int port = host.getPort();
if (port < 0) {
Scheme scheme = connManager.getSchemeRegistry().getScheme(host);
port = scheme.getDefaultPort();
}
-
+
AuthScheme authScheme = authState.getAuthScheme();
AuthScope authScope = new AuthScope(
hostname,
port,
- authScheme.getRealm(),
- authScheme.getSchemeName());
-
+ authScheme.getRealm(),
+ authScheme.getSchemeName());
+
if (this.log.isDebugEnabled()) {
this.log.debug("Authentication scope: " + authScope);
}
@@ -1239,5 +1239,5 @@ public class DefaultRequestDirector impl
authState.setAuthScope(authScope);
authState.setCredentials(creds);
}
-
+
} // class DefaultClientRequestDirector
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultTargetAuthenticationHandler.java Fri Apr 23 19:19:23 2010
@@ -42,20 +42,20 @@ import org.apache.http.client.Authentica
import org.apache.http.protocol.HttpContext;
/**
- * Default {@link AuthenticationHandler} implementation for target host
+ * Default {@link AuthenticationHandler} implementation for target host
* authentication.
- *
+ *
* @since 4.0
*/
-@Immutable
+@Immutable
public class DefaultTargetAuthenticationHandler extends AbstractAuthenticationHandler {
public DefaultTargetAuthenticationHandler() {
super();
}
-
+
public boolean isAuthenticationRequested(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -65,7 +65,7 @@ public class DefaultTargetAuthentication
}
public Map<String, Header> getChallenges(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) throws MalformedChallengeException {
if (response == null) {
throw new IllegalArgumentException("HTTP response may not be null");
@@ -76,7 +76,7 @@ public class DefaultTargetAuthentication
@Override
protected List<String> getAuthPreferences(
- final HttpResponse response,
+ final HttpResponse response,
final HttpContext context) {
@SuppressWarnings("unchecked")
List<String> authpref = (List<String>) response.getParams().getParameter(
@@ -87,6 +87,6 @@ public class DefaultTargetAuthentication
return super.getAuthPreferences(response, context);
}
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java Fri Apr 23 19:19:23 2010
@@ -42,16 +42,16 @@ import org.apache.http.protocol.Executio
import org.apache.http.protocol.HttpContext;
/**
- * Default implementation of {@link UserTokenHandler}. This class will use
- * an instance of {@link Principal} as a state object for HTTP connections,
- * if it can be obtained from the given execution context. This helps ensure
- * persistent connections created with a particular user identity within
+ * Default implementation of {@link UserTokenHandler}. This class will use
+ * an instance of {@link Principal} as a state object for HTTP connections,
+ * if it can be obtained from the given execution context. This helps ensure
+ * persistent connections created with a particular user identity within
* a particular security context can be reused by the same user only.
* <p>
* DefaultUserTokenHandler will use the user principle of connection
- * based authentication schemes such as NTLM or that of the SSL session
- * with the client authentication turned on. If both are unavailable,
- * <code>null</code> token will be returned.
+ * based authentication schemes such as NTLM or that of the SSL session
+ * with the client authentication turned on. If both are unavailable,
+ * <code>null</code> token will be returned.
*
* @since 4.0
*/
@@ -59,9 +59,9 @@ import org.apache.http.protocol.HttpCont
public class DefaultUserTokenHandler implements UserTokenHandler {
public Object getUserToken(final HttpContext context) {
-
+
Principal userPrincipal = null;
-
+
AuthState targetAuthState = (AuthState) context.getAttribute(
ClientContext.TARGET_AUTH_STATE);
if (targetAuthState != null) {
@@ -72,7 +72,7 @@ public class DefaultUserTokenHandler imp
userPrincipal = getAuthPrincipal(proxyAuthState);
}
}
-
+
if (userPrincipal == null) {
ManagedClientConnection conn = (ManagedClientConnection) context.getAttribute(
ExecutionContext.HTTP_CONNECTION);
@@ -83,7 +83,7 @@ public class DefaultUserTokenHandler imp
}
}
}
-
+
return userPrincipal;
}
@@ -92,10 +92,10 @@ public class DefaultUserTokenHandler imp
if (scheme != null && scheme.isComplete() && scheme.isConnectionBased()) {
Credentials creds = authState.getCredentials();
if (creds != null) {
- return creds.getUserPrincipal();
+ return creds.getUserPrincipal();
}
}
return null;
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/EntityEnclosingRequestWrapper.java Fri Apr 23 19:19:23 2010
@@ -36,8 +36,8 @@ import org.apache.http.ProtocolException
import org.apache.http.protocol.HTTP;
/**
- * A wrapper class for {@link HttpEntityEnclosingRequest}s that can
- * be used to change properties of the current request without
+ * A wrapper class for {@link HttpEntityEnclosingRequest}s that can
+ * be used to change properties of the current request without
* modifying the original object.
* </p>
* This class is also capable of resetting the request headers to
@@ -47,12 +47,12 @@ import org.apache.http.protocol.HTTP;
* @since 4.0
*/
@NotThreadSafe // e.g. [gs]etEntity()
-public class EntityEnclosingRequestWrapper extends RequestWrapper
+public class EntityEnclosingRequestWrapper extends RequestWrapper
implements HttpEntityEnclosingRequest {
-
+
private HttpEntity entity;
-
- public EntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request)
+
+ public EntityEnclosingRequestWrapper(final HttpEntityEnclosingRequest request)
throws ProtocolException {
super(request);
this.entity = request.getEntity();
@@ -65,7 +65,7 @@ public class EntityEnclosingRequestWrapp
public void setEntity(final HttpEntity entity) {
this.entity = entity;
}
-
+
public boolean expectContinue() {
Header expect = getFirstHeader(HTTP.EXPECT_DIRECTIVE);
return expect != null && HTTP.EXPECT_CONTINUE.equalsIgnoreCase(expect.getValue());
@@ -75,5 +75,5 @@ public class EntityEnclosingRequestWrapp
public boolean isRepeatable() {
return this.entity == null || this.entity.isRepeatable();
}
-
+
}
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java?rev=937479&r1=937478&r2=937479&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/RedirectLocations.java Fri Apr 23 19:19:23 2010
@@ -46,20 +46,20 @@ public class RedirectLocations {
private final Set<URI> unique;
private final List<URI> all;
-
+
public RedirectLocations() {
super();
this.unique = new HashSet<URI>();
this.all = new ArrayList<URI>();
}
-
+
/**
* Test if the URI is present in the collection.
*/
public boolean contains(final URI uri) {
return this.unique.contains(uri);
}
-
+
/**
* Adds a new URI to the collection.
*/
@@ -84,12 +84,12 @@ public class RedirectLocations {
}
return removed;
}
-
+
/**
* Returns all redirect {@link URI}s in the order they were added to the collection.
- *
+ *
* @return list of all URIs
- *
+ *
* @since 4.1
*/
public List<URI> getAll() {