TABS -> SPACES
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1156167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e3d0d9e1e
commit
444c6bf0e8
|
@ -116,14 +116,14 @@ public class AuthScope {
|
|||
public AuthScope(final HttpHost host, final String realm, final String schemeName) {
|
||||
this(host.getHostName(), host.getPort(), realm, schemeName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 4.2
|
||||
*/
|
||||
public AuthScope(final HttpHost host) {
|
||||
this(host, ANY_REALM, ANY_SCHEME);
|
||||
}
|
||||
|
||||
|
||||
/** Creates a new credentials scope for the given
|
||||
* <tt>host</tt>, <tt>port</tt>, <tt>realm</tt>, and any
|
||||
* authentication scheme.
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.http.conn.routing.HttpRoute;
|
|||
* Represents a controller that dynamically adjusts the size
|
||||
* of an available connection pool based on feedback from
|
||||
* using the connections.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ public interface BackoffManager {
|
|||
* backoff signal.
|
||||
*/
|
||||
public void backOff(HttpRoute route);
|
||||
|
||||
|
||||
/**
|
||||
* Called when we have determined that the result of
|
||||
* using a connection has succeeded and that we may
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.http.HttpResponse;
|
|||
* result in a backoff signal or not, based on either examining the
|
||||
* <code>Throwable</code> that resulted or by examining the resulting
|
||||
* response (e.g. for its status code).
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -68,7 +68,7 @@ public class UrlEncodedFormEntity extends StringEntity {
|
|||
* @param parameters iterable collection of name/value pairs
|
||||
* @param encoding encoding the name/value pairs be encoded with
|
||||
* @throws UnsupportedEncodingException if the encoding isn't supported
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public UrlEncodedFormEntity (
|
||||
|
@ -97,7 +97,7 @@ public class UrlEncodedFormEntity extends StringEntity {
|
|||
*
|
||||
* @param parameters iterable collection of name/value pairs
|
||||
* @throws UnsupportedEncodingException if the default encoding isn't supported
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public UrlEncodedFormEntity (
|
||||
|
|
|
@ -64,12 +64,12 @@ public final class CookiePolicy {
|
|||
public static final String BEST_MATCH = "best-match";
|
||||
|
||||
/**
|
||||
* The policy that ignores cookies.
|
||||
*
|
||||
* The policy that ignores cookies.
|
||||
*
|
||||
* @since 4.1-beta1
|
||||
*/
|
||||
public static final String IGNORE_COOKIES = "ignoreCookies";
|
||||
|
||||
|
||||
private CookiePolicy() {
|
||||
super();
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class HttpClientParams {
|
|||
|
||||
/**
|
||||
* Set the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static void setConnectionManagerTimeout(final HttpParams params, long timeout) {
|
||||
|
@ -108,10 +108,10 @@ public class HttpClientParams {
|
|||
|
||||
/**
|
||||
* Get the connectiion manager timeout value.
|
||||
* This is defined by the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}.
|
||||
* Failing that it uses the parameter {@code CoreConnectionPNames.CONNECTION_TIMEOUT}
|
||||
* This is defined by the parameter {@code ClientPNames.CONN_MANAGER_TIMEOUT}.
|
||||
* Failing that it uses the parameter {@code CoreConnectionPNames.CONNECTION_TIMEOUT}
|
||||
* which defaults to 0 if not defined.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
* @return the timeout value
|
||||
*/
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ClientContextConfigurer implements ClientContext {
|
|||
|
||||
/**
|
||||
* @deprecated (4.1-alpha1) Use {@link HttpParams#setParameter(String, Object)} to set the parameters
|
||||
* {@link org.apache.http.auth.params.AuthPNames#TARGET_AUTH_PREF AuthPNames#TARGET_AUTH_PREF} and
|
||||
* {@link org.apache.http.auth.params.AuthPNames#TARGET_AUTH_PREF AuthPNames#TARGET_AUTH_PREF} and
|
||||
* {@link org.apache.http.auth.params.AuthPNames#PROXY_AUTH_PREF AuthPNames#PROXY_AUTH_PREF} instead
|
||||
*/
|
||||
@Deprecated
|
||||
|
|
|
@ -274,11 +274,11 @@ public class URIUtils {
|
|||
|
||||
/**
|
||||
* Extracts target host from the given {@link URI}.
|
||||
*
|
||||
* @param uri
|
||||
* @return the target host if the URI is absolute or <code>null</null> if the URI is
|
||||
*
|
||||
* @param uri
|
||||
* @return the target host if the URI is absolute or <code>null</null> if the URI is
|
||||
* relative or does not contain a valid host name.
|
||||
*
|
||||
*
|
||||
* @since 4.1
|
||||
*/
|
||||
public static HttpHost extractHost(final URI uri) {
|
||||
|
@ -303,15 +303,15 @@ public class URIUtils {
|
|||
}
|
||||
}
|
||||
// Extract the port suffix, if present
|
||||
if (host != null) {
|
||||
if (host != null) {
|
||||
int colon = host.indexOf(':');
|
||||
if (colon >= 0) {
|
||||
if (colon+1 < host.length()) {
|
||||
port = Integer.parseInt(host.substring(colon+1));
|
||||
}
|
||||
host = host.substring(0,colon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String scheme = uri.getScheme();
|
||||
|
@ -321,7 +321,7 @@ public class URIUtils {
|
|||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class should not be instantiated.
|
||||
*/
|
||||
|
|
|
@ -205,7 +205,7 @@ public class URLEncodedUtils {
|
|||
*
|
||||
* @param parameters The parameters to include.
|
||||
* @param encoding The encoding to use.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public static String format (
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.http.HttpHost;
|
|||
/**
|
||||
* Extended {@link InetSocketAddress} implementation that also provides access to the original
|
||||
* {@link HttpHost} used to resolve the address.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public class HttpInetSocketAddress extends InetSocketAddress {
|
||||
|
@ -42,7 +42,7 @@ public class HttpInetSocketAddress extends InetSocketAddress {
|
|||
private static final long serialVersionUID = -6650701828361907957L;
|
||||
|
||||
private final HttpHost host;
|
||||
|
||||
|
||||
public HttpInetSocketAddress(final HttpHost host, final InetAddress addr, int port) {
|
||||
super(addr, port);
|
||||
if (host == null) {
|
||||
|
@ -60,5 +60,5 @@ public class HttpInetSocketAddress extends InetSocketAddress {
|
|||
return this.host.getHostName() + ":" + getPort();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ public final class HttpRoute implements RouteInfo, Cloneable {
|
|||
if (this == obj) return true;
|
||||
if (obj instanceof HttpRoute) {
|
||||
HttpRoute that = (HttpRoute) obj;
|
||||
return
|
||||
return
|
||||
// Do the cheapest tests first
|
||||
(this.secure == that.secure) &&
|
||||
(this.tunnelled == that.tunnelled) &&
|
||||
|
|
|
@ -210,7 +210,7 @@ public abstract class AbstractVerifier implements X509HostnameVerifier {
|
|||
String hostSuffix = hostName.substring(prefix.length()); // skip wildcard part from host
|
||||
match = hostName.startsWith(prefix) && hostSuffix.endsWith(suffix);
|
||||
} else {
|
||||
match = hostName.endsWith(cn.substring(1));
|
||||
match = hostName.endsWith(cn.substring(1));
|
||||
}
|
||||
if(match && strictWithSubDomains) {
|
||||
// If we're in strict mode, then [*.foo.com] is not
|
||||
|
|
|
@ -520,7 +520,7 @@ public class SSLSocketFactory implements LayeredSchemeSocketFactory, LayeredSock
|
|||
*
|
||||
* The default implementation is a no-op, but could be overriden to, e.g.,
|
||||
* call {@link SSLSocket#setEnabledCipherSuites(java.lang.String[])}.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
protected void prepareSocket(final SSLSocket socket) throws IOException {
|
||||
|
|
|
@ -38,18 +38,18 @@ import org.apache.http.conn.routing.HttpRoute;
|
|||
* the number of connections allowed to a given host. You may want
|
||||
* to experiment with the settings for the cooldown periods and the
|
||||
* backoff factor to get the adaptive behavior you want.</p>
|
||||
*
|
||||
*
|
||||
* <p>Generally speaking, shorter cooldowns will lead to more steady-state
|
||||
* variability but faster reaction times, while longer cooldowns
|
||||
* will lead to more stable equilibrium behavior but slower reaction
|
||||
* times.</p>
|
||||
*
|
||||
*
|
||||
* <p>Similarly, higher backoff factors promote greater
|
||||
* utilization of available capacity at the expense of fairness
|
||||
* among clients. Lower backoff factors allow equal distribution of
|
||||
* capacity among clients (fairness) to happen faster, at the
|
||||
* expense of having more server capacity unused in the short term.</p>
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public class AIMDBackoffManager implements BackoffManager {
|
||||
|
@ -64,7 +64,7 @@ public class AIMDBackoffManager implements BackoffManager {
|
|||
private Map<HttpRoute,Long> lastRouteBackoffs =
|
||||
new HashMap<HttpRoute,Long>();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates an <code>AIMDBackoffManager</code> to manage
|
||||
* per-host connection pool sizes represented by the
|
||||
|
@ -75,7 +75,7 @@ public class AIMDBackoffManager implements BackoffManager {
|
|||
public AIMDBackoffManager(ConnPerRouteBean connPerRoute) {
|
||||
this(connPerRoute, new SystemClock());
|
||||
}
|
||||
|
||||
|
||||
AIMDBackoffManager(ConnPerRouteBean connPerRoute, Clock clock) {
|
||||
this.clock = clock;
|
||||
this.connPerRoute = connPerRoute;
|
||||
|
@ -100,12 +100,12 @@ public class AIMDBackoffManager implements BackoffManager {
|
|||
public void probe(HttpRoute route) {
|
||||
synchronized(connPerRoute) {
|
||||
int curr = connPerRoute.getMaxForRoute(route);
|
||||
int max = (curr >= cap) ? cap : curr + 1;
|
||||
int max = (curr >= cap) ? cap : curr + 1;
|
||||
Long lastProbe = getLastUpdate(lastRouteProbes, route);
|
||||
Long lastBackoff = getLastUpdate(lastRouteBackoffs, route);
|
||||
long now = clock.getCurrentTime();
|
||||
if (now - lastProbe < coolDown || now - lastBackoff < coolDown)
|
||||
return;
|
||||
return;
|
||||
connPerRoute.setMaxForRoute(route, max);
|
||||
lastRouteProbes.put(route, now);
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ public class AIMDBackoffManager implements BackoffManager {
|
|||
}
|
||||
backoffFactor = d;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of time, in milliseconds, to wait between
|
||||
* adjustments in pool sizes for a given host, to allow
|
||||
* enough time for the adjustments to take effect. Defaults
|
||||
* to 5000L (5 seconds).
|
||||
* to 5000L (5 seconds).
|
||||
* @param l must be positive
|
||||
*/
|
||||
public void setCooldownMillis(long l) {
|
||||
|
@ -146,7 +146,7 @@ public class AIMDBackoffManager implements BackoffManager {
|
|||
}
|
||||
coolDown = l;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the absolute maximum per-host connection pool size to
|
||||
* probe up to; defaults to 2 (the default per-host max).
|
||||
|
|
|
@ -254,11 +254,11 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
/** The connection backoff strategy. */
|
||||
@GuardedBy("this")
|
||||
private ConnectionBackoffStrategy connectionBackoffStrategy;
|
||||
|
||||
|
||||
/** The backoff manager. */
|
||||
@GuardedBy("this")
|
||||
private BackoffManager backoffManager;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new HTTP client.
|
||||
*
|
||||
|
@ -379,7 +379,7 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
public void probe(HttpRoute ignored) { }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protected ConnectionBackoffStrategy createConnectionBackoffStrategy() {
|
||||
return new NullBackoffStrategy();
|
||||
}
|
||||
|
@ -481,8 +481,8 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
supportedAuthSchemes = createAuthSchemeRegistry();
|
||||
}
|
||||
return supportedAuthSchemes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public synchronized void setAuthSchemes(final AuthSchemeRegistry authSchemeRegistry) {
|
||||
supportedAuthSchemes = authSchemeRegistry;
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
}
|
||||
return connectionBackoffStrategy;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setConnectionBackoffStrategy(final ConnectionBackoffStrategy strategy) {
|
||||
connectionBackoffStrategy = strategy;
|
||||
}
|
||||
|
@ -511,11 +511,11 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
}
|
||||
return backoffManager;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setBackoffManager(final BackoffManager manager) {
|
||||
backoffManager = manager;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void setCookieSpecs(final CookieSpecRegistry cookieSpecRegistry) {
|
||||
supportedCookieSpecs = cookieSpecRegistry;
|
||||
}
|
||||
|
@ -859,8 +859,8 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
: (HttpHost) determineParams(request).getParameter(
|
||||
ClientPNames.DEFAULT_HOST);
|
||||
HttpRoute route = getRoutePlanner().determineRoute(targetForRoute, request, execContext);
|
||||
|
||||
HttpResponse out;
|
||||
|
||||
HttpResponse out;
|
||||
try {
|
||||
out = director.execute(target, request, execContext);
|
||||
} catch (RuntimeException re) {
|
||||
|
@ -915,7 +915,7 @@ public abstract class AbstractHttpClient implements HttpClient {
|
|||
stateHandler,
|
||||
params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @since 4.1
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.apache.http.impl.client;
|
|||
|
||||
/**
|
||||
* Interface used to enable easier testing of time-related behavior.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.http.client.ConnectionBackoffStrategy;
|
|||
* This {@link ConnectionBackoffStrategy} backs off either for a raw
|
||||
* network socket or connection timeout or if the server explicitly
|
||||
* sends a 503 (Service Unavailable) response.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public class DefaultBackoffStrategy implements ConnectionBackoffStrategy {
|
||||
|
|
|
@ -52,16 +52,16 @@ import org.apache.http.protocol.HttpContext;
|
|||
import org.apache.http.protocol.ExecutionContext;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link RedirectStrategy}. This strategy honors the restrictions
|
||||
* Default implementation of {@link RedirectStrategy}. This strategy honors the restrictions
|
||||
* on automatic redirection of entity enclosing methods such as POST and PUT imposed by the
|
||||
* HTTP specification. <tt>302 Moved Temporarily</tt>, <tt>301 Moved Permanently</tt> and
|
||||
* <tt>307 Temporary Redirect</tt> status codes will result in an automatic redirect of
|
||||
* HEAD and GET methods only. POST and PUT methods will not be automatically redirected
|
||||
* HTTP specification. <tt>302 Moved Temporarily</tt>, <tt>301 Moved Permanently</tt> and
|
||||
* <tt>307 Temporary Redirect</tt> status codes will result in an automatic redirect of
|
||||
* HEAD and GET methods only. POST and PUT methods will not be automatically redirected
|
||||
* as requiring user confirmation.
|
||||
* <p/>
|
||||
* The restriction on automatic redirection of POST methods can be relaxed by using
|
||||
* {@link LaxRedirectStrategy} instead of {@link DefaultRedirectStrategy}.
|
||||
*
|
||||
*
|
||||
* @see LaxRedirectStrategy
|
||||
* @since 4.1
|
||||
*/
|
||||
|
|
|
@ -358,7 +358,7 @@ public class DefaultRequestDirector implements RequestDirector {
|
|||
|
||||
virtualHost = (HttpHost) orig.getParams().getParameter(
|
||||
ClientPNames.VIRTUAL_HOST);
|
||||
|
||||
|
||||
// HTTPCLIENT-1092 - add the port if necessary
|
||||
if (virtualHost != null && virtualHost.getPort() == -1) {
|
||||
int port = target.getPort();
|
||||
|
@ -500,8 +500,8 @@ public class DefaultRequestDirector implements RequestDirector {
|
|||
managedConn.markReusable();
|
||||
} else {
|
||||
managedConn.close();
|
||||
invalidateAuthIfSuccessful(this.proxyAuthState);
|
||||
invalidateAuthIfSuccessful(this.targetAuthState);
|
||||
invalidateAuthIfSuccessful(this.proxyAuthState);
|
||||
invalidateAuthIfSuccessful(this.targetAuthState);
|
||||
}
|
||||
// check if we can use the same connection for the followup
|
||||
if (!followup.getRoute().equals(roureq.getRoute())) {
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
|
|||
* Lax {@link RedirectStrategy} implementation that automatically redirects all HEAD, GET and POST
|
||||
* requests. This strategy relaxes restrictions on automatic redirection of POST methods imposed
|
||||
* by the HTTP specification.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
@Immutable
|
||||
|
@ -52,16 +52,16 @@ public class LaxRedirectStrategy extends DefaultRedirectStrategy {
|
|||
/**
|
||||
* Redirectable methods.
|
||||
*/
|
||||
private static final String[] REDIRECT_METHODS = new String[] {
|
||||
private static final String[] REDIRECT_METHODS = new String[] {
|
||||
HttpGet.METHOD_NAME,
|
||||
HttpPost.METHOD_NAME,
|
||||
HttpHead.METHOD_NAME
|
||||
HttpPost.METHOD_NAME,
|
||||
HttpHead.METHOD_NAME
|
||||
};
|
||||
|
||||
@Override
|
||||
public boolean isRedirected(
|
||||
final HttpRequest request,
|
||||
final HttpResponse response,
|
||||
final HttpRequest request,
|
||||
final HttpResponse response,
|
||||
final HttpContext context) throws ProtocolException {
|
||||
if (request == null) {
|
||||
throw new IllegalArgumentException("HTTP request may not be null");
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.http.client.ConnectionBackoffStrategy;
|
|||
/**
|
||||
* This is a {@link ConnectionBackoffStrategy} that never backs off,
|
||||
* for compatibility with existing behavior.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
public class NullBackoffStrategy implements ConnectionBackoffStrategy {
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.apache.http.impl.client;
|
|||
|
||||
/**
|
||||
* The actual system clock.
|
||||
*
|
||||
*
|
||||
* @since 4.2
|
||||
*/
|
||||
class SystemClock implements Clock {
|
||||
|
|
|
@ -135,7 +135,7 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
|
|||
this.connPerRoute = connPerRoute;
|
||||
this.connOperator = createConnectionOperator(schreg);
|
||||
this.pool = createConnectionPool(connTTL, connTTLTimeUnit) ;
|
||||
this.connectionPool = this.pool;
|
||||
this.connectionPool = this.pool;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.http.params.HttpParams;
|
|||
|
||||
/**
|
||||
* {@link CookieSpecFactory} implementation that ignores all cookies.
|
||||
*
|
||||
*
|
||||
* @since 4.1
|
||||
*/
|
||||
@Immutable
|
||||
|
|
Loading…
Reference in New Issue