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