hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1414680 [2/3] - in /httpcomponents/httpclient/trunk/httpclient/src: examples/org/apache/http/examples/client/ main/java/org/apache/http/auth/params/ main/java/org/apache/http/client/config/ main/java/org/apache/http/client/methods/ main/ja...
Date Wed, 28 Nov 2012 13:45:18 GMT
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestScheme.java Wed Nov 28 13:45:06 2012
@@ -27,6 +27,7 @@
 package org.apache.http.impl.auth;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.security.MessageDigest;
 import java.security.SecureRandom;
 import java.util.ArrayList;
@@ -39,6 +40,7 @@ import java.util.StringTokenizer;
 
 import org.apache.http.annotation.NotThreadSafe;
 
+import org.apache.http.Consts;
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
@@ -49,7 +51,6 @@ import org.apache.http.auth.ContextAware
 import org.apache.http.auth.Credentials;
 import org.apache.http.auth.AUTH;
 import org.apache.http.auth.MalformedChallengeException;
-import org.apache.http.auth.params.AuthParams;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.message.BasicHeaderValueFormatter;
 import org.apache.http.message.BufferedHeader;
@@ -64,22 +65,10 @@ import org.apache.http.util.EncodingUtil
  * Currently only qop=auth or no qop is supported. qop=auth-int
  * is unsupported. If auth and auth-int are provided, auth is
  * used.
- * <p>
- * Credential charset is configured via the
- * {@link org.apache.http.auth.params.AuthPNames#CREDENTIAL_CHARSET}
- * parameter of the HTTP request.
- * <p>
+ * <p/>
  * Since the digest username is included as clear text in the generated
  * Authentication header, the charset of the username must be compatible
- * with the
- * {@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET
- *        http element charset}.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.auth.params.AuthPNames#CREDENTIAL_CHARSET}</li>
- * </ul>
+ * with the HTTP element charset used by the connection.
  *
  * @since 4.0
  */
@@ -112,18 +101,28 @@ public class DigestScheme extends RFC261
     private String a2;
 
     /**
+     * @since 4.3
+     */
+    public DigestScheme(final Charset credentialsCharset) {
+        super(credentialsCharset);
+        this.complete = false;
+    }
+
+    /**
      * Creates an instance of <tt>DigestScheme</tt> with the given challenge
      * state.
      *
      * @since 4.2
+     *
+     * @deprecated (4.3) do not use.
      */
+    @Deprecated
     public DigestScheme(final ChallengeState challengeState) {
         super(challengeState);
-        this.complete = false;
     }
 
     public DigestScheme() {
-        this(null);
+        this(Consts.ASCII);
     }
 
     /**
@@ -181,7 +180,7 @@ public class DigestScheme extends RFC261
     /**
      * @deprecated (4.2) Use {@link ContextAwareAuthScheme#authenticate(Credentials, HttpRequest, org.apache.http.protocol.HttpContext)}
      */
-    @Deprecated 
+    @Deprecated
     public Header authenticate(
             final Credentials credentials, final HttpRequest request) throws AuthenticationException {
         return authenticate(credentials, request, new BasicHttpContext());
@@ -224,8 +223,7 @@ public class DigestScheme extends RFC261
         getParameters().put("uri", request.getRequestLine().getUri());
         String charset = getParameter("charset");
         if (charset == null) {
-            charset = AuthParams.getCredentialCharset(request.getParams());
-            getParameters().put("charset", charset);
+            getParameters().put("charset", getCredentialsCharset(request));
         }
         return createDigestHeader(credentials, request);
     }
@@ -430,7 +428,7 @@ public class DigestScheme extends RFC261
                 buffer.append(", ");
             }
             boolean noQuotes = "nc".equals(param.getName()) || "qop".equals(param.getName());
-            BasicHeaderValueFormatter.DEFAULT.formatNameValuePair(buffer, param, !noQuotes);
+            BasicHeaderValueFormatter.INSTANCE.formatNameValuePair(buffer, param, !noQuotes);
         }
         return new BufferedHeader(buffer);
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/DigestSchemeFactory.java Wed Nov 28 13:45:06 2012
@@ -27,6 +27,8 @@
 
 package org.apache.http.impl.auth;
 
+import java.nio.charset.Charset;
+
 import org.apache.http.annotation.Immutable;
 
 import org.apache.http.auth.AuthScheme;
@@ -45,12 +47,26 @@ import org.apache.http.protocol.HttpCont
 @SuppressWarnings("deprecation")
 public class DigestSchemeFactory implements AuthSchemeFactory, AuthSchemeProvider {
 
+    private final Charset charset;
+
+    /**
+     * @since 4.3
+     */
+    public DigestSchemeFactory(final Charset charset) {
+        super();
+        this.charset = charset;
+    }
+
+    public DigestSchemeFactory() {
+        this(null);
+    }
+
     public AuthScheme newInstance(final HttpParams params) {
         return new DigestScheme();
     }
 
     public AuthScheme create(final HttpContext context) {
-        return new DigestScheme();
+        return new DigestScheme(this.charset);
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java Wed Nov 28 13:45:06 2012
@@ -36,8 +36,9 @@ import org.apache.http.auth.ContextAware
 import org.apache.http.auth.Credentials;
 import org.apache.http.auth.InvalidCredentialsException;
 import org.apache.http.auth.MalformedChallengeException;
+import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.CharArrayBuffer;
 import org.ietf.jgss.GSSContext;
@@ -131,16 +132,18 @@ public abstract class GGSSchemeBase exte
             throw new AuthenticationException(getSchemeName() + " authentication has failed");
         case CHALLENGE_RECEIVED:
             try {
-                String key = null;
+                HttpRoute route = (HttpRoute) context.getAttribute(ClientContext.ROUTE);
+                if (route == null) {
+                    throw new AuthenticationException("Connection route is not available");
+                }
+                HttpHost host;
                 if (isProxy()) {
-                    key = ExecutionContext.HTTP_PROXY_HOST;
+                    host = route.getProxyHost();
+                    if (host == null) {
+                        host = route.getTargetHost();
+                    }
                 } else {
-                    key = ExecutionContext.HTTP_TARGET_HOST;
-                }
-                HttpHost host = (HttpHost) context.getAttribute(key);
-                if (host == null) {
-                    throw new AuthenticationException("Authentication host is not set " +
-                            "in the execution context");
+                    host = route.getTargetHost();
                 }
                 String authServer;
                 if (!this.stripPort && host.getPort() > 0) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/RFC2617Scheme.java Wed Nov 28 13:45:06 2012
@@ -26,15 +26,19 @@
 
 package org.apache.http.impl.auth;
 
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 
 import org.apache.http.annotation.NotThreadSafe;
 
+import org.apache.http.Consts;
 import org.apache.http.HeaderElement;
+import org.apache.http.HttpRequest;
 import org.apache.http.auth.ChallengeState;
 import org.apache.http.auth.MalformedChallengeException;
+import org.apache.http.auth.params.AuthPNames;
 import org.apache.http.message.BasicHeaderValueParser;
 import org.apache.http.message.HeaderValueParser;
 import org.apache.http.message.ParserCursor;
@@ -47,27 +51,55 @@ import org.apache.http.util.CharArrayBuf
  *
  * @since 4.0
  */
+@SuppressWarnings("deprecation")
 @NotThreadSafe // AuthSchemeBase, params
 public abstract class RFC2617Scheme extends AuthSchemeBase {
 
-    /**
-     * Authentication parameter map.
-     */
     private final Map<String, String> params;
+    private final Charset credentialsCharset;
 
     /**
      * Creates an instance of <tt>RFC2617Scheme</tt> with the given challenge
      * state.
      *
      * @since 4.2
+     *
+     * @deprecated (4.3) do not use.
      */
+    @Deprecated
     public RFC2617Scheme(final ChallengeState challengeState) {
         super(challengeState);
         this.params = new HashMap<String, String>();
+        this.credentialsCharset = Consts.ASCII;
+    }
+
+    /**
+     * @since 4.3
+     */
+    public RFC2617Scheme(final Charset credentialsCharset) {
+        super();
+        this.params = new HashMap<String, String>();
+        this.credentialsCharset = credentialsCharset != null ? credentialsCharset : Consts.ASCII;
     }
 
     public RFC2617Scheme() {
-        this(null);
+        this(Consts.ASCII);
+    }
+
+
+    /**
+     * @since 4.3
+     */
+    public Charset getCredentialsCharset() {
+        return credentialsCharset;
+    }
+
+    String getCredentialsCharset(final HttpRequest request) {
+        String charset = (String) request.getParams().getParameter(AuthPNames.CREDENTIAL_CHARSET);
+        if (charset == null) {
+            charset = getCredentialsCharset().name();
+        }
+        return charset;
     }
 
     @Override

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/AuthenticationStrategyImpl.java Wed Nov 28 13:45:06 2012
@@ -28,6 +28,7 @@
 package org.apache.http.impl.client;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -52,7 +53,8 @@ import org.apache.http.auth.MalformedCha
 import org.apache.http.client.AuthCache;
 import org.apache.http.client.AuthenticationStrategy;
 import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.params.AuthPolicy;
+import org.apache.http.client.config.AuthSchemes;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Lookup;
 import org.apache.http.protocol.HTTP;
@@ -60,28 +62,26 @@ import org.apache.http.protocol.HttpCont
 import org.apache.http.util.CharArrayBuffer;
 
 @Immutable
-class AuthenticationStrategyImpl implements AuthenticationStrategy {
+abstract class AuthenticationStrategyImpl implements AuthenticationStrategy {
 
     private final Log log = LogFactory.getLog(getClass());
 
     private static final List<String> DEFAULT_SCHEME_PRIORITY =
         Collections.unmodifiableList(Arrays.asList(new String[] {
-                AuthPolicy.SPNEGO,
-                AuthPolicy.KERBEROS,
-                AuthPolicy.NTLM,
-                AuthPolicy.DIGEST,
-                AuthPolicy.BASIC
+                AuthSchemes.SPNEGO,
+                AuthSchemes.KERBEROS,
+                AuthSchemes.NTLM,
+                AuthSchemes.DIGEST,
+                AuthSchemes.BASIC
     }));
 
     private final int challengeCode;
     private final String headerName;
-    private final String prefParamName;
 
-    AuthenticationStrategyImpl(int challengeCode, final String headerName, final String prefParamName) {
+    AuthenticationStrategyImpl(int challengeCode, final String headerName) {
         super();
         this.challengeCode = challengeCode;
         this.headerName = headerName;
-        this.prefParamName = prefParamName;
     }
 
     public boolean isAuthenticationRequested(
@@ -133,6 +133,8 @@ class AuthenticationStrategyImpl impleme
         return map;
     }
 
+    abstract Collection<String> getPreferredAuthSchemes(RequestConfig config);
+
     public Queue<AuthOption> select(
             final Map<String, Header> challenges,
             final HttpHost authhost,
@@ -163,9 +165,8 @@ class AuthenticationStrategyImpl impleme
             this.log.debug("Credentials provider not set in the context");
             return options;
         }
-
-        @SuppressWarnings("unchecked")
-        List<String> authPrefs = (List<String>) response.getParams().getParameter(this.prefParamName);
+        RequestConfig config = clientContext.getRequestConfig();
+        Collection<String> authPrefs = getPreferredAuthSchemes(config);
         if (authPrefs == null) {
             authPrefs = DEFAULT_SCHEME_PRIORITY;
         }
@@ -240,8 +241,8 @@ class AuthenticationStrategyImpl impleme
             return false;
         }
         String schemeName = authScheme.getSchemeName();
-        return schemeName.equalsIgnoreCase(AuthPolicy.BASIC) ||
-                schemeName.equalsIgnoreCase(AuthPolicy.DIGEST);
+        return schemeName.equalsIgnoreCase(AuthSchemes.BASIC) ||
+                schemeName.equalsIgnoreCase(AuthSchemes.DIGEST);
     }
 
     public void authFailed(

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=1414680&r1=1414679&r2=1414680&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 Wed Nov 28 13:45:06 2012
@@ -41,13 +41,13 @@ import org.apache.http.ProtocolException
 import org.apache.http.annotation.Immutable;
 import org.apache.http.client.CircularRedirectException;
 import org.apache.http.client.RedirectStrategy;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpHead;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.client.methods.RequestBuilder;
-import org.apache.http.client.params.ClientPNames;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.client.utils.URIUtils;
-import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 
@@ -126,6 +126,9 @@ public class DefaultRedirectStrategy imp
         if (context == null) {
             throw new IllegalArgumentException("HTTP context may not be null");
         }
+
+        HttpClientContext clientContext = HttpClientContext.adapt(context);
+
         //get the location header to find out where to redirect to
         Header locationHeader = response.getFirstHeader("location");
         if (locationHeader == null) {
@@ -139,16 +142,17 @@ public class DefaultRedirectStrategy imp
             this.log.debug("Redirect requested to location '" + location + "'");
         }
 
+        RequestConfig config = clientContext.getRequestConfig();
+
         URI uri = createLocationURI(location);
 
-        HttpParams params = request.getParams();
         // rfc2616 demands the location value be a complete URI
         // Location       = "Location" ":" absoluteURI
         try {
             // Drop fragment
             uri = URIUtils.rewriteURI(uri);
             if (!uri.isAbsolute()) {
-                if (params.isParameterTrue(ClientPNames.REJECT_RELATIVE_REDIRECT)) {
+                if (!config.isRelativeRedirectsAllowed()) {
                     throw new ProtocolException("Relative redirect location '"
                             + uri + "' not allowed");
                 }
@@ -172,7 +176,7 @@ public class DefaultRedirectStrategy imp
             redirectLocations = new RedirectLocations();
             context.setAttribute(REDIRECT_LOCATIONS, redirectLocations);
         }
-        if (params.isParameterFalse(ClientPNames.ALLOW_CIRCULAR_REDIRECTS)) {
+        if (!config.isCircularRedirectsAllowed()) {
             if (redirectLocations.contains(uri)) {
                 throw new CircularRedirectException("Circular redirect to '" + uri + "'");
             }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/ProxyAuthenticationStrategy.java Wed Nov 28 13:45:06 2012
@@ -27,11 +27,13 @@
 
 package org.apache.http.impl.client;
 
+import java.util.Collection;
+
 import org.apache.http.HttpStatus;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.auth.AUTH;
-import org.apache.http.auth.params.AuthPNames;
 import org.apache.http.client.AuthenticationStrategy;
+import org.apache.http.client.config.RequestConfig;
 
 /**
  * Default {@link AuthenticationStrategy} implementation for proxy host authentication.
@@ -44,7 +46,12 @@ public class ProxyAuthenticationStrategy
     public static final ProxyAuthenticationStrategy INSTANCE = new ProxyAuthenticationStrategy();
 
     public ProxyAuthenticationStrategy() {
-        super(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED, AUTH.PROXY_AUTH, AuthPNames.PROXY_AUTH_PREF);
+        super(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED, AUTH.PROXY_AUTH);
+    }
+
+    @Override
+    Collection<String> getPreferredAuthSchemes(final RequestConfig config) {
+        return config.getProxyPreferredAuthSchemes();
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/TargetAuthenticationStrategy.java Wed Nov 28 13:45:06 2012
@@ -27,11 +27,13 @@
 
 package org.apache.http.impl.client;
 
+import java.util.Collection;
+
 import org.apache.http.HttpStatus;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.auth.AUTH;
-import org.apache.http.auth.params.AuthPNames;
 import org.apache.http.client.AuthenticationStrategy;
+import org.apache.http.client.config.RequestConfig;
 
 /**
  * Default {@link AuthenticationStrategy} implementation for proxy host authentication.
@@ -44,7 +46,12 @@ public class TargetAuthenticationStrateg
     public static final TargetAuthenticationStrategy INSTANCE = new TargetAuthenticationStrategy();
 
     public TargetAuthenticationStrategy() {
-        super(HttpStatus.SC_UNAUTHORIZED, AUTH.WWW_AUTH, AuthPNames.TARGET_AUTH_PREF);
+        super(HttpStatus.SC_UNAUTHORIZED, AUTH.WWW_AUTH);
+    }
+
+    @Override
+    Collection<String> getPreferredAuthSchemes(final RequestConfig config) {
+        return config.getTargetPreferredAuthSchemes();
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/BackoffStrategyExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/BackoffStrategyExec.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/BackoffStrategyExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/BackoffStrategyExec.java Wed Nov 28 13:45:06 2012
@@ -36,8 +36,8 @@ import org.apache.http.client.BackoffMan
 import org.apache.http.client.ConnectionBackoffStrategy;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpExecutionAware;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.protocol.HttpContext;
 
 /**
  * @since 4.3
@@ -71,7 +71,7 @@ class BackoffStrategyExec implements Cli
     public CloseableHttpResponse execute(
             final HttpRoute route,
             final HttpRequestWrapper request,
-            final HttpContext context,
+            final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
         if (route == null) {
             throw new IllegalArgumentException("HTTP route may not be null");

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ClientExecChain.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ClientExecChain.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ClientExecChain.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ClientExecChain.java Wed Nov 28 13:45:06 2012
@@ -32,8 +32,8 @@ import java.io.IOException;
 import org.apache.http.HttpException;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpExecutionAware;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.protocol.HttpContext;
 
 /**
  * This interface represents an element in the HTTP request execution chain. Each element can
@@ -52,7 +52,7 @@ interface ClientExecChain {
     CloseableHttpResponse execute(
             HttpRoute route,
             HttpRequestWrapper request,
-            HttpContext context,
+            HttpClientContext clientContext,
             HttpExecutionAware execAware) throws IOException, HttpException;
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpClientBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpClientBuilder.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpClientBuilder.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpClientBuilder.java Wed Nov 28 13:45:06 2012
@@ -28,11 +28,13 @@
 package org.apache.http.impl.client.builder;
 
 import java.net.ProxySelector;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
 
 import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.Header;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponseInterceptor;
 import org.apache.http.annotation.NotThreadSafe;
@@ -47,13 +49,15 @@ import org.apache.http.client.HttpReques
 import org.apache.http.client.RedirectStrategy;
 import org.apache.http.client.ServiceUnavailableRetryStrategy;
 import org.apache.http.client.UserTokenHandler;
-import org.apache.http.client.params.AuthPolicy;
-import org.apache.http.client.params.CookiePolicy;
+import org.apache.http.client.config.AuthSchemes;
+import org.apache.http.client.config.CookieSpecs;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.protocol.RequestAcceptEncoding;
 import org.apache.http.client.protocol.RequestAddCookies;
 import org.apache.http.client.protocol.RequestAuthCache;
 import org.apache.http.client.protocol.RequestClientConnControl;
 import org.apache.http.client.protocol.RequestDefaultHeaders;
+import org.apache.http.client.protocol.RequestExpectContinue;
 import org.apache.http.client.protocol.ResponseContentEncoding;
 import org.apache.http.client.protocol.ResponseProcessCookies;
 import org.apache.http.config.Lookup;
@@ -98,7 +102,6 @@ import org.apache.http.protocol.HttpProc
 import org.apache.http.protocol.HttpProcessorBuilder;
 import org.apache.http.protocol.HttpRequestExecutor;
 import org.apache.http.protocol.RequestContent;
-import org.apache.http.protocol.RequestExpectContinue;
 import org.apache.http.protocol.RequestTargetHost;
 import org.apache.http.protocol.RequestUserAgent;
 import org.apache.http.util.VersionInfo;
@@ -125,6 +128,7 @@ import org.apache.http.util.VersionInfo;
  *  <li>http.nonProxyHosts</li>
  *  <li>http.keepAlive</li>
  *  <li>http.maxConnections</li>
+ *  <li>http.user</li>
  * </ul>
  * </p>
  *
@@ -161,6 +165,9 @@ public class HttpClientBuilder {
     private Map<String, CookieSpecProvider> cookieSpecs;
     private CookieStore cookieStore;
     private CredentialsProvider credentialsProvider;
+    private String userAgent;
+    private Collection<? extends Header> defaultHeaders;
+    private RequestConfig defaultConfig;
 
     private boolean systemProperties;
     private boolean redirectHandlingDisabled;
@@ -365,6 +372,21 @@ public class HttpClientBuilder {
         return this;
     }
 
+    public final HttpClientBuilder setUserAgent(final String userAgent) {
+        this.userAgent = userAgent;
+        return this;
+    }
+
+    public final HttpClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
+        this.defaultHeaders = defaultHeaders;
+        return this;
+    }
+
+    public final HttpClientBuilder setDefaultConfig(final RequestConfig defaultConfig) {
+        this.defaultConfig = defaultConfig;
+        return this;
+    }
+
     public final HttpClientBuilder disableRedirectHandling() {
         redirectHandlingDisabled = true;
         return this;
@@ -489,10 +511,17 @@ public class HttpClientBuilder {
         HttpProcessor httpprocessor = this.httpprocessor;
         if (httpprocessor == null) {
 
-            VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client",
-                    HttpClientBuilder.class.getClassLoader());
-            String release = vi != null ? vi.getRelease() : VersionInfo.UNAVAILABLE;
-            String defaultAgent = "Apache-HttpClient/" + release + " (java 1.5)";
+            String userAgent = this.userAgent;
+            if (userAgent == null) {
+                if (systemProperties) {
+                    userAgent = System.getProperty("http.agent");
+                } else {
+                    VersionInfo vi = VersionInfo.loadVersionInfo("org.apache.http.client",
+                            HttpClientBuilder.class.getClassLoader());
+                    String release = vi != null ? vi.getRelease() : VersionInfo.UNAVAILABLE;
+                    userAgent = "Apache-HttpClient/" + release + " (java 1.5)";
+                }
+            }
 
             HttpProcessorBuilder b = HttpProcessorBuilder.create();
             if (requestFirst != null) {
@@ -506,11 +535,11 @@ public class HttpClientBuilder {
                 }
             }
             b.addAll(
-                    new RequestDefaultHeaders(),
+                    new RequestDefaultHeaders(defaultHeaders),
                     new RequestContent(),
                     new RequestTargetHost(),
                     new RequestClientConnControl(),
-                    new RequestUserAgent(defaultAgent),
+                    new RequestUserAgent(userAgent),
                     new RequestExpectContinue());
             if (!cookieManagementDisabled) {
                 b.add(new RequestAddCookies());
@@ -585,11 +614,11 @@ public class HttpClientBuilder {
         Lookup<AuthSchemeProvider> authSchemeRegistry = this.authSchemeRegistry;
         if (authSchemeRegistry == null) {
             RegistryBuilder<AuthSchemeProvider> b = RegistryBuilder.<AuthSchemeProvider>create();
-            b.register(AuthPolicy.BASIC, new BasicSchemeFactory())
-                .register(AuthPolicy.DIGEST, new DigestSchemeFactory())
-                .register(AuthPolicy.NTLM, new NTLMSchemeFactory())
-                .register(AuthPolicy.SPNEGO, new SPNegoSchemeFactory())
-                .register(AuthPolicy.KERBEROS, new KerberosSchemeFactory())
+            b.register(AuthSchemes.BASIC, new BasicSchemeFactory())
+                .register(AuthSchemes.DIGEST, new DigestSchemeFactory())
+                .register(AuthSchemes.NTLM, new NTLMSchemeFactory())
+                .register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory())
+                .register(AuthSchemes.KERBEROS, new KerberosSchemeFactory())
                 .build();
             if (authShemes != null) {
                 for (Map.Entry<String, AuthSchemeProvider> entry: authShemes.entrySet()) {
@@ -601,12 +630,12 @@ public class HttpClientBuilder {
         Lookup<CookieSpecProvider> cookieSpecRegistry = this.cookieSpecRegistry;
         if (cookieSpecRegistry == null) {
             RegistryBuilder<CookieSpecProvider> b = RegistryBuilder.<CookieSpecProvider>create();
-            b.register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory())
-                .register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory())
-                .register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory())
-                .register(CookiePolicy.RFC_2109, new RFC2109SpecFactory())
-                .register(CookiePolicy.RFC_2965, new RFC2965SpecFactory())
-                .register(CookiePolicy.IGNORE_COOKIES, new IgnoreSpecFactory());
+            b.register(CookieSpecs.BEST_MATCH, new BestMatchSpecFactory())
+                .register(CookieSpecs.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory())
+                .register(CookieSpecs.NETSCAPE, new NetscapeDraftSpecFactory())
+                .register(CookieSpecs.RFC_2109, new RFC2109SpecFactory())
+                .register(CookieSpecs.RFC_2965, new RFC2965SpecFactory())
+                .register(CookieSpecs.IGNORE_COOKIES, new IgnoreSpecFactory());
             if (cookieSpecs != null) {
                 for (Map.Entry<String, CookieSpecProvider> entry: cookieSpecs.entrySet()) {
                     b.register(entry.getKey(), entry.getValue());
@@ -632,7 +661,8 @@ public class HttpClientBuilder {
                 cookieSpecRegistry,
                 authSchemeRegistry,
                 defaultCookieStore,
-                defaultCredentialsProvider);
+                defaultCredentialsProvider,
+                defaultConfig != null ? defaultConfig : RequestConfig.DEFAULT);
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpRequestWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpRequestWrapper.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpRequestWrapper.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/HttpRequestWrapper.java Wed Nov 28 13:45:06 2012
@@ -66,7 +66,6 @@ class HttpRequestWrapper extends Abstrac
         } else {
             this.uri = null;
         }
-        setParams(request.getParams());
         setHeaders(request.getAllHeaders());
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/InternalHttpClient.java Wed Nov 28 13:45:06 2012
@@ -39,9 +39,12 @@ import org.apache.http.auth.AuthState;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.CredentialsProvider;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.Configurable;
 import org.apache.http.client.methods.HttpExecutionAware;
 import org.apache.http.client.params.ClientPNames;
+import org.apache.http.client.params.HttpParamConfig;
 import org.apache.http.client.protocol.ClientContext;
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Lookup;
@@ -54,9 +57,8 @@ import org.apache.http.conn.routing.Http
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.cookie.CookieSpecProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.params.DefaultedHttpParams;
+import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.params.SyncBasicHttpParams;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 
@@ -64,6 +66,7 @@ import org.apache.http.protocol.HttpCont
  * @since 4.3
  */
 @ThreadSafe
+@SuppressWarnings("deprecation")
 class InternalHttpClient extends CloseableHttpClient {
 
     private final ClientExecChain execChain;
@@ -73,6 +76,7 @@ class InternalHttpClient extends Closeab
     private final Lookup<AuthSchemeProvider> authSchemeRegistry;
     private final CookieStore cookieStore;
     private final CredentialsProvider credentialsProvider;
+    private final RequestConfig defaultConfig;
     private final HttpParams params;
 
     public InternalHttpClient(
@@ -82,7 +86,8 @@ class InternalHttpClient extends Closeab
             final Lookup<CookieSpecProvider> cookieSpecRegistry,
             final Lookup<AuthSchemeProvider> authSchemeRegistry,
             final CookieStore cookieStore,
-            final CredentialsProvider credentialsProvider) {
+            final CredentialsProvider credentialsProvider,
+            final RequestConfig defaultConfig) {
         super();
         if (execChain == null) {
             throw new IllegalArgumentException("HTTP client exec chain may not be null");
@@ -100,7 +105,8 @@ class InternalHttpClient extends Closeab
         this.authSchemeRegistry = authSchemeRegistry;
         this.cookieStore = cookieStore;
         this.credentialsProvider = credentialsProvider;
-        this.params = new SyncBasicHttpParams();
+        this.defaultConfig = defaultConfig != null ? defaultConfig : RequestConfig.DEFAULT;
+        this.params = new BasicHttpParams();
     }
 
     private HttpRoute determineRoute(
@@ -117,7 +123,7 @@ class InternalHttpClient extends Closeab
         return this.routePlanner.determineRoute(host, request, context);
     }
 
-    private HttpContext setupContext(final HttpContext localContext) {
+    private HttpClientContext setupContext(final HttpContext localContext) {
         HttpClientContext context = HttpClientContext.adapt(
                 localContext != null ? localContext : new BasicHttpContext());
         if (context.getAttribute(ClientContext.TARGET_AUTH_STATE) == null) {
@@ -154,14 +160,23 @@ class InternalHttpClient extends Closeab
             execListner = (HttpExecutionAware) request;
         }
         try {
-            HttpParams params = new DefaultedHttpParams(request.getParams(), getParams());
+            HttpParams params = request.getParams();
             HttpHost virtualHost = (HttpHost) params.getParameter(ClientPNames.VIRTUAL_HOST);
 
             HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(request);
-            wrapper.setParams(params);
             wrapper.setVirtualHost(virtualHost);
-            HttpContext localcontext = setupContext(context);
+            HttpClientContext localcontext = setupContext(context);
             HttpRoute route = determineRoute(target, wrapper, localcontext);
+            RequestConfig config = null;
+            if (request instanceof Configurable) {
+                config = ((Configurable) request).getConfig();
+            } else {
+                config = HttpParamConfig.getRequestConfig(params);
+            }
+            if (config == null) {
+                config = this.defaultConfig;
+            }
+            localcontext.setRequestConfig(config);
             return this.execChain.execute(route, wrapper, localcontext, execListner);
         } catch (HttpException httpException) {
             throw new ClientProtocolException(httpException);
@@ -173,10 +188,9 @@ class InternalHttpClient extends Closeab
     }
 
     public void close() {
-        connManager.shutdown();
+        this.connManager.shutdown();
     }
 
-    @SuppressWarnings("deprecation")
     public ClientConnectionManager getConnectionManager() {
 
         return new ClientConnectionManager() {

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/MainClientExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/MainClientExec.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/MainClientExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/MainClientExec.java Wed Nov 28 13:45:06 2012
@@ -41,7 +41,6 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponse;
-import org.apache.http.ProtocolVersion;
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.auth.AUTH;
 import org.apache.http.auth.AuthProtocolState;
@@ -49,9 +48,9 @@ import org.apache.http.auth.AuthState;
 import org.apache.http.client.AuthenticationStrategy;
 import org.apache.http.client.NonRepeatableRequestException;
 import org.apache.http.client.UserTokenHandler;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpExecutionAware;
-import org.apache.http.client.params.HttpClientParams;
 import org.apache.http.client.protocol.ClientContext;
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.client.protocol.RequestClientConnControl;
@@ -68,11 +67,7 @@ import org.apache.http.impl.client.Reque
 import org.apache.http.impl.client.TunnelRefusedException;
 import org.apache.http.impl.conn.ConnectionShutdownException;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpProtocolParams;
 import org.apache.http.protocol.ExecutionContext;
-import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestExecutor;
 import org.apache.http.protocol.ImmutableHttpProcessor;
@@ -80,30 +75,6 @@ import org.apache.http.protocol.RequestU
 import org.apache.http.util.EntityUtils;
 
 /**
- * <p>
- * 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>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#HTTP_ELEMENT_CHARSET}</li>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#USE_EXPECT_CONTINUE}</li>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#WAIT_FOR_CONTINUE}</li>
- *  <li>{@link org.apache.http.params.CoreProtocolPNames#USER_AGENT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SOCKET_BUFFER_SIZE}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_LINE_LENGTH}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#MAX_HEADER_COUNT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_TIMEOUT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_LINGER}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#SO_REUSEADDR}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#TCP_NODELAY}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#CONNECTION_TIMEOUT}</li>
- *  <li>{@link org.apache.http.params.CoreConnectionPNames#STALE_CONNECTION_CHECK}</li>
- *  <li>{@link org.apache.http.auth.params.AuthPNames#CREDENTIAL_CHARSET}</li>
- *  <li>{@link org.apache.http.client.params.ClientPNames#HANDLE_AUTHENTICATION}</li>
- *  <li>{@link org.apache.http.client.params.ClientPNames#CONN_MANAGER_TIMEOUT}</li>
- * </ul>
- *
  * @since 4.3
  */
 @ThreadSafe
@@ -170,7 +141,7 @@ class MainClientExec implements ClientEx
     public CloseableHttpResponse execute(
             final HttpRoute route,
             final HttpRequestWrapper request,
-            final HttpContext context,
+            final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
         if (route == null) {
             throw new IllegalArgumentException("HTTP route may not be null");
@@ -182,22 +153,18 @@ class MainClientExec implements ClientEx
             throw new IllegalArgumentException("HTTP context may not be null");
         }
 
-        HttpClientContext clientContext = HttpClientContext.adapt(context);
-
-        AuthState targetAuthState = clientContext.getTargetAuthState();
+        AuthState targetAuthState = context.getTargetAuthState();
         if (targetAuthState == null) {
             targetAuthState = new AuthState();
             context.setAttribute(ClientContext.TARGET_AUTH_STATE, targetAuthState);
         }
-        AuthState proxyAuthState = clientContext.getProxyAuthState();
+        AuthState proxyAuthState = context.getProxyAuthState();
         if (proxyAuthState == null) {
             proxyAuthState = new AuthState();
             context.setAttribute(ClientContext.PROXY_AUTH_STATE, proxyAuthState);
         }
 
-        HttpParams params = request.getParams();
-
-        Object userToken = clientContext.getUserToken();
+        Object userToken = context.getUserToken();
 
         final ConnectionRequest connRequest = connManager.requestConnection(route, userToken);
         if (execAware != null) {
@@ -209,17 +176,19 @@ class MainClientExec implements ClientEx
             }
         }
 
+        RequestConfig config = context.getRequestConfig();
+
         HttpClientConnection managedConn;
         try {
-            long timeout = HttpClientParams.getConnectionManagerTimeout(params);
-            managedConn = connRequest.get(timeout, TimeUnit.MILLISECONDS);
+            int timeout = config.getConnectionRequestTimeout();
+            managedConn = connRequest.get(timeout > 0 ? timeout : 0, TimeUnit.MILLISECONDS);
         } catch(InterruptedException interrupted) {
             throw new RequestAbortedException("Request aborted", interrupted);
         }
 
         context.setAttribute(ExecutionContext.HTTP_CONNECTION, managedConn);
 
-        if (HttpConnectionParams.isStaleCheckingEnabled(params)) {
+        if (config.isStaleConnectionCheckEnabled()) {
             // validate connection
             if (managedConn.isOpen()) {
                 this.log.debug("Stale connection check");
@@ -266,7 +235,10 @@ class MainClientExec implements ClientEx
                         break;
                     }
                 } else {
-                    managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params));
+                    int timeout = config.getSocketTimeout();
+                    if (timeout >= 0) {
+                        managedConn.setSocketTimeout(timeout);
+                    }
                 }
 
                 if (execAware != null && execAware.isAborted()) {
@@ -291,7 +263,6 @@ class MainClientExec implements ClientEx
                 }
 
                 response = requestExecutor.execute(request, managedConn, context);
-                response.setParams(params);
 
                 // The connection is in or can be brought to a re-usable state.
                 if (reuseStrategy.keepAlive(response, context)) {
@@ -385,8 +356,9 @@ class MainClientExec implements ClientEx
             final HttpClientConnection managedConn,
             final HttpRoute route,
             final HttpRequest request,
-            final HttpContext context) throws HttpException, IOException {
-        HttpParams params = request.getParams();
+            final HttpClientContext context) throws HttpException, IOException {
+        RequestConfig config = context.getRequestConfig();
+        int timeout = config.getConnectTimeout();
         RouteTracker tracker = new RouteTracker(route);
         int step;
         do {
@@ -397,17 +369,24 @@ class MainClientExec implements ClientEx
 
             case HttpRouteDirector.CONNECT_TARGET:
                 this.connManager.connect(
-                        managedConn, route.getTargetHost(), route.getLocalAddress(), context);
+                        managedConn,
+                        route.getTargetHost(), route.getLocalAddress(),
+                        timeout > 0 ? timeout : 0,
+                        context);
                 tracker.connectTarget(route.isSecure());
                 break;
             case HttpRouteDirector.CONNECT_PROXY:
                 this.connManager.connect(
-                        managedConn, route.getProxyHost(), route.getLocalAddress(), context);
+                        managedConn,
+                        route.getProxyHost(), route.getLocalAddress(),
+                        timeout > 0 ? timeout : 0,
+                        context);
                 HttpHost proxy  = route.getProxyHost();
                 tracker.connectProxy(proxy, false);
                 break;
             case HttpRouteDirector.TUNNEL_TARGET: {
-                boolean secure = createTunnelToTarget(proxyAuthState, managedConn, route, request, context);
+                boolean secure = createTunnelToTarget(
+                        proxyAuthState, managedConn, route, request, context);
                 this.log.debug("Tunnel to target created.");
                 tracker.tunnelTarget(secure);
             }   break;
@@ -454,24 +433,27 @@ class MainClientExec implements ClientEx
             final HttpClientConnection managedConn,
             final HttpRoute route,
             final HttpRequest request,
-            final HttpContext context) throws HttpException, IOException {
+            final HttpClientContext context) throws HttpException, IOException {
+
+        RequestConfig config = context.getRequestConfig();
+        int timeout = config.getConnectTimeout();
 
-        HttpParams params = request.getParams();
         HttpHost target = route.getTargetHost();
         HttpHost proxy = route.getProxyHost();
         HttpResponse response = null;
 
         String authority = target.toHostString();
-        ProtocolVersion ver = HttpProtocolParams.getVersion(params);
-        HttpRequest connect = new BasicHttpRequest("CONNECT", authority, ver);
-        connect.setParams(params);
+        HttpRequest connect = new BasicHttpRequest("CONNECT", authority, request.getProtocolVersion());
 
         this.requestExecutor.preProcess(connect, this.proxyHttpProcessor, context);
 
         for (;;) {
             if (!managedConn.isOpen()) {
                 this.connManager.connect(
-                        managedConn, route.getProxyHost(), route.getLocalAddress(), context);
+                        managedConn,
+                        route.getProxyHost(), route.getLocalAddress(),
+                        timeout > 0 ? timeout : 0,
+                        context);
             }
 
             connect.removeHeaders(AUTH.PROXY_AUTH_RESP);
@@ -485,7 +467,7 @@ class MainClientExec implements ClientEx
                         response.getStatusLine());
             }
 
-            if (HttpClientParams.isAuthenticating(params)) {
+            if (config.isAuthenticationEnabled()) {
                 if (this.authenticator.isAuthenticationRequested(proxy, response,
                         this.proxyAuthStrategy, proxyAuthState, context)) {
                     if (this.authenticator.handleAuthChallenge(proxy, response,
@@ -538,7 +520,7 @@ class MainClientExec implements ClientEx
     private boolean createTunnelToProxy(
             final HttpRoute route,
             final int hop,
-            final HttpContext context) throws HttpException, IOException {
+            final HttpClientContext context) throws HttpException, IOException {
 
         // Have a look at createTunnelToTarget and replicate the parts
         // you need in a custom derived class. If your proxies don't require
@@ -558,11 +540,10 @@ class MainClientExec implements ClientEx
             final HttpRoute route,
             final HttpRequestWrapper request,
             final HttpResponse response,
-            final HttpContext context) throws HttpException, IOException {
-
-        HttpParams params = request.getParams();
-        if (HttpClientParams.isAuthenticating(params)) {
-            HttpHost target = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
+            final HttpClientContext context) throws HttpException, IOException {
+        RequestConfig config = context.getRequestConfig();
+        if (config.isAuthenticationEnabled()) {
+            HttpHost target = context.getTargetHost();
             if (target == null) {
                 target = route.getTargetHost();
             }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ProtocolExec.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ProtocolExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ProtocolExec.java Wed Nov 28 13:45:06 2012
@@ -47,7 +47,6 @@ import org.apache.http.client.utils.URIU
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.impl.auth.BasicScheme;
 import org.apache.http.protocol.ExecutionContext;
-import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 
 /**
@@ -107,7 +106,7 @@ class ProtocolExec implements ClientExec
     public CloseableHttpResponse execute(
             final HttpRoute route,
             final HttpRequestWrapper request,
-            final HttpContext context,
+            final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
         if (route == null) {
             throw new IllegalArgumentException("HTTP route may not be null");
@@ -119,12 +118,10 @@ class ProtocolExec implements ClientExec
             throw new IllegalArgumentException("HTTP context may not be null");
         }
 
-        HttpClientContext clientContext = HttpClientContext.adapt(context);
-
         HttpHost target = route.getTargetHost();
 
         // Get user info from the URI
-        AuthState targetAuthState = clientContext.getTargetAuthState();
+        AuthState targetAuthState = context.getTargetAuthState();
         if (targetAuthState != null) {
             String userinfo = request.getURI().getUserInfo();
             if (userinfo != null) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RedirectExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RedirectExec.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RedirectExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RedirectExec.java Wed Nov 28 13:45:06 2012
@@ -41,27 +41,16 @@ import org.apache.http.auth.AuthScheme;
 import org.apache.http.auth.AuthState;
 import org.apache.http.client.RedirectException;
 import org.apache.http.client.RedirectStrategy;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpExecutionAware;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.client.params.HttpClientParams;
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.client.utils.URIUtils;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.conn.routing.HttpRoutePlanner;
-import org.apache.http.params.HttpParams;
-import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.EntityUtils;
 
 /**
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.client.params.ClientPNames#HANDLE_REDIRECTS}</li>
- *  <li>{@link org.apache.http.client.params.ClientPNames#MAX_REDIRECTS}</li>
- *  <li>{@link org.apache.http.client.params.ClientPNames#ALLOW_CIRCULAR_REDIRECTS}</li>
- * </ul>
- *
  * @since 4.3
  */
 @ThreadSafe
@@ -95,7 +84,7 @@ class RedirectExec implements ClientExec
     public CloseableHttpResponse execute(
             final HttpRoute route,
             final HttpRequestWrapper request,
-            final HttpContext context,
+            final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
         if (route == null) {
             throw new IllegalArgumentException("HTTP route may not be null");
@@ -107,17 +96,15 @@ class RedirectExec implements ClientExec
             throw new IllegalArgumentException("HTTP context may not be null");
         }
 
-        HttpClientContext clientContext = HttpClientContext.adapt(context);
-
-        HttpParams params = request.getParams();
-        int maxRedirects = params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100);
+        RequestConfig config = context.getRequestConfig();
+        int maxRedirects = config.getMaxRedirects() > 0 ? config.getMaxRedirects() : 50;
         HttpRoute currentRoute = route;
         HttpRequestWrapper currentRequest = request;
         for (int redirectCount = 0;;) {
             CloseableHttpResponse response = requestExecutor.execute(
                     currentRoute, currentRequest, context, execAware);
             try {
-                if (HttpClientParams.isRedirecting(params) &&
+                if (config.isRedirectsEnabled() &&
                         this.redirectStrategy.isRedirected(currentRequest, response, context)) {
 
                     if (redirectCount >= maxRedirects) {
@@ -129,7 +116,6 @@ class RedirectExec implements ClientExec
                     HttpRequest original = currentRequest.getOriginal();
                     currentRequest = HttpRequestWrapper.wrap(redirect);
                     currentRequest.setHeaders(original.getAllHeaders());
-                    currentRequest.setParams(params);
 
                     URI uri = currentRequest.getURI();
                     HttpHost newTarget = URIUtils.extractHost(uri);
@@ -140,12 +126,12 @@ class RedirectExec implements ClientExec
 
                     // Reset virtual host and auth states if redirecting to another host
                     if (!currentRoute.getTargetHost().equals(newTarget)) {
-                        AuthState targetAuthState = clientContext.getTargetAuthState();
+                        AuthState targetAuthState = context.getTargetAuthState();
                         if (targetAuthState != null) {
                             this.log.debug("Resetting target auth state");
                             targetAuthState.reset();
                         }
-                        AuthState proxyAuthState = clientContext.getProxyAuthState();
+                        AuthState proxyAuthState = context.getProxyAuthState();
                         if (proxyAuthState != null) {
                             AuthScheme authScheme = proxyAuthState.getAuthScheme();
                             if (authScheme != null && authScheme.isConnectionBased()) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RetryExec.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RetryExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/RetryExec.java Wed Nov 28 13:45:06 2012
@@ -40,8 +40,8 @@ import org.apache.http.client.NonRepeata
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpExecutionAware;
 import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.protocol.HttpContext;
 
 /**
  * @since 4.3
@@ -70,7 +70,7 @@ class RetryExec implements ClientExecCha
     public CloseableHttpResponse execute(
             final HttpRoute route,
             final HttpRequestWrapper request,
-            final HttpContext context,
+            final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
         if (route == null) {
             throw new IllegalArgumentException("HTTP route may not be null");

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ServiceUnavailableRetryExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ServiceUnavailableRetryExec.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ServiceUnavailableRetryExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/builder/ServiceUnavailableRetryExec.java Wed Nov 28 13:45:06 2012
@@ -37,8 +37,8 @@ import org.apache.http.annotation.Thread
 import org.apache.http.client.ServiceUnavailableRetryStrategy;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpExecutionAware;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.protocol.HttpContext;
 
 /**
  * {@link ClientExecChain} implementation that can automatically retry the request in case of
@@ -72,7 +72,7 @@ class ServiceUnavailableRetryExec implem
     public CloseableHttpResponse execute(
             final HttpRoute route, 
             final HttpRequestWrapper request,
-            final HttpContext context, 
+            final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
         for (int c = 1;; c++) {
             CloseableHttpResponse response = this.requestExecutor.execute(

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/BasicHttpClientConnectionManager.java Wed Nov 28 13:45:06 2012
@@ -308,6 +308,7 @@ public class BasicHttpClientConnectionMa
             final HttpClientConnection conn,
             final HttpHost host,
             final InetAddress local,
+            final int connectTimeout,
             final HttpContext context) throws IOException {
         if (conn == null) {
             throw new IllegalArgumentException("Connection may not be null");
@@ -320,7 +321,7 @@ public class BasicHttpClientConnectionMa
         }
         InetSocketAddress localAddress = local != null ? new InetSocketAddress(local, 0) : null;
         this.connectionOperator.connect(this.conn, host, localAddress,
-                this.connConfig.getConnectTimeout(), this.socketConfig, context);
+                connectTimeout, this.socketConfig, context);
     }
 
     public void upgrade(

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultRoutePlanner.java Wed Nov 28 13:45:06 2012
@@ -33,8 +33,9 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.annotation.Immutable;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.conn.SchemePortResolver;
-import org.apache.http.conn.params.ConnRouteParams;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.conn.routing.HttpRoutePlanner;
 import org.apache.http.protocol.HttpContext;
@@ -44,14 +45,6 @@ import org.apache.http.protocol.HttpCont
  * is based on {@link org.apache.http.conn.params.ConnRoutePNames parameters}.
  * It will not make use of any Java system properties, nor of system or
  * browser proxy settings.
- * <p>
- * The following parameters can be used to customize the behavior of this
- * class:
- * <ul>
- *  <li>{@link org.apache.http.conn.params.ConnRoutePNames#DEFAULT_PROXY}</li>
- *  <li>{@link org.apache.http.conn.params.ConnRoutePNames#LOCAL_ADDRESS}</li>
- *  <li>{@link org.apache.http.conn.params.ConnRoutePNames#FORCED_ROUTE}</li>
- * </ul>
  *
  * @since 4.3
  */
@@ -76,15 +69,13 @@ public class DefaultRoutePlanner impleme
         if (request == null) {
             throw new IllegalArgumentException("Request may not be null");
         }
-        // If we have a forced route, we can do without a target.
-        HttpRoute route = ConnRouteParams.getForcedRoute(request.getParams());
-        if (route != null) {
-            return route;
-        }
-        // If we get here, there is no forced route.
-        // So we need a target to compute a route.
-        InetAddress local = ConnRouteParams.getLocalAddress(request.getParams());
+        HttpClientContext clientContext = HttpClientContext.adapt(context);
+        RequestConfig config = clientContext.getRequestConfig();
+        InetAddress local = config.getLocalAddress();
         HttpHost proxy = determineProxy(host, request, context);
+        if (proxy == null) {
+            proxy = config.getDefaultProxy();
+        }
 
         HttpHost target;
         if (host.getPort() <= 0) {
@@ -97,18 +88,17 @@ public class DefaultRoutePlanner impleme
         }
         boolean secure = target.getSchemeName().equalsIgnoreCase("https");
         if (proxy == null) {
-            route = new HttpRoute(target, local, secure);
+            return new HttpRoute(target, local, secure);
         } else {
-            route = new HttpRoute(target, local, proxy, secure);
+            return new HttpRoute(target, local, proxy, secure);
         }
-        return route;
     }
 
     protected HttpHost determineProxy(
             final HttpHost target,
             final HttpRequest request,
             final HttpContext context) throws HttpException {
-        return ConnRouteParams.getDefaultProxy(request.getParams());
+        return null;
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionManagerBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionManagerBase.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionManagerBase.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionManagerBase.java Wed Nov 28 13:45:06 2012
@@ -193,6 +193,7 @@ abstract class HttpClientConnectionManag
             final HttpClientConnection managedConn,
             final HttpHost host,
             final InetAddress local,
+            final int connectTimeout,
             final HttpContext context) throws IOException {
         if (managedConn == null) {
             throw new IllegalArgumentException("Connection may not be null");
@@ -213,7 +214,7 @@ abstract class HttpClientConnectionManag
 
         InetSocketAddress localAddress = local != null ? new InetSocketAddress(local, 0) : null;
         this.connectionOperator.connect(conn, host, localAddress,
-                connConfig.getConnectTimeout(), socketConfig, context);
+                connectTimeout, socketConfig, context);
     }
 
     public void upgrade(

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestHttpRequestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestHttpRequestBase.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestHttpRequestBase.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestHttpRequestBase.java Wed Nov 28 13:45:06 2012
@@ -33,7 +33,6 @@ import org.apache.http.Header;
 import org.apache.http.HttpVersion;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
-import org.apache.http.params.HttpProtocolParams;
 import org.apache.http.util.LangUtils;
 import org.junit.Assert;
 import org.junit.Test;
@@ -43,11 +42,9 @@ public class TestHttpRequestBase {
     @Test
     public void testBasicProperties() throws Exception {
         HttpGet httpget = new HttpGet("http://host/path");
-        httpget.getParams().setParameter(
-                HttpProtocolParams.PROTOCOL_VERSION, HttpVersion.HTTP_1_0);
         Assert.assertEquals("GET", httpget.getRequestLine().getMethod());
         Assert.assertEquals("http://host/path", httpget.getRequestLine().getUri());
-        Assert.assertEquals(HttpVersion.HTTP_1_0, httpget.getRequestLine().getProtocolVersion());
+        Assert.assertEquals(HttpVersion.HTTP_1_1, httpget.getRequestLine().getProtocolVersion());
     }
 
     @Test
@@ -62,8 +59,6 @@ public class TestHttpRequestBase {
         httpget.addHeader("h1", "this header");
         httpget.addHeader("h2", "that header");
         httpget.addHeader("h3", "all sorts of headers");
-        httpget.getParams().setParameter("p1", Integer.valueOf(1));
-        httpget.getParams().setParameter("p2", "whatever");
         HttpGet clone = (HttpGet) httpget.clone();
 
         Assert.assertEquals(httpget.getMethod(), clone.getMethod());
@@ -73,11 +68,6 @@ public class TestHttpRequestBase {
         Header[] headers2 = clone.getAllHeaders();
 
         Assert.assertTrue(LangUtils.equals(headers1, headers2));
-        Assert.assertTrue(httpget.getParams() != clone.getParams());
-
-        Assert.assertEquals(Integer.valueOf(1), clone.getParams().getParameter("p1"));
-        Assert.assertEquals("whatever", clone.getParams().getParameter("p2"));
-        Assert.assertEquals(null, clone.getParams().getParameter("p3"));
     }
 
     @Test
@@ -86,8 +76,6 @@ public class TestHttpRequestBase {
         httppost.addHeader("h1", "this header");
         httppost.addHeader("h2", "that header");
         httppost.addHeader("h3", "all sorts of headers");
-        httppost.getParams().setParameter("p1", Integer.valueOf(1));
-        httppost.getParams().setParameter("p2", "whatever");
         HttpPost clone = (HttpPost) httppost.clone();
 
         Assert.assertEquals(httppost.getMethod(), clone.getMethod());
@@ -97,11 +85,6 @@ public class TestHttpRequestBase {
         Header[] headers2 = clone.getAllHeaders();
 
         Assert.assertTrue(LangUtils.equals(headers1, headers2));
-        Assert.assertTrue(httppost.getParams() != clone.getParams());
-
-        Assert.assertEquals(Integer.valueOf(1), clone.getParams().getParameter("p1"));
-        Assert.assertEquals("whatever", clone.getParams().getParameter("p2"));
-        Assert.assertEquals(null, clone.getParams().getParameter("p3"));
 
         Assert.assertNull(clone.getEntity());
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java Wed Nov 28 13:45:06 2012
@@ -33,11 +33,10 @@ import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpVersion;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -89,14 +88,14 @@ public class TestRequestBuilder {
     @Test
     public void testCopy() throws Exception {
         HttpEntity entity = new StringEntity("stuff");
-        HttpParams params = new BasicHttpParams();
+        RequestConfig config = RequestConfig.custom().build();
         HttpUriRequest request = RequestBuilder.createPut()
             .setUri(URI.create("/stuff"))
             .setVersion(HttpVersion.HTTP_1_0)
             .addHeader("header1", "stuff")
             .setHeader("header2", "more stuff")
             .setEntity(entity)
-            .setParams(params)
+            .setConfig(config)
             .build();
         Assert.assertNotNull(request);
         Assert.assertEquals("PUT", request.getMethod());
@@ -109,20 +108,21 @@ public class TestRequestBuilder {
         Assert.assertEquals(URI.create("/other-stuff"), copy.getURI());
         Assert.assertTrue(copy instanceof HttpEntityEnclosingRequest);
         Assert.assertSame(entity, ((HttpEntityEnclosingRequest) copy).getEntity());
-        Assert.assertSame(params, copy.getParams());
+        Assert.assertTrue(copy instanceof Configurable);
+        Assert.assertSame(config, ((Configurable) copy).getConfig());
     }
 
     @Test
     public void testClone() throws Exception {
         HttpEntity entity = new StringEntity("stuff");
-        HttpParams params = new BasicHttpParams();
+        RequestConfig config = RequestConfig.custom().build();
         HttpUriRequest request = RequestBuilder.createPut()
             .setUri(URI.create("/stuff"))
             .setVersion(HttpVersion.HTTP_1_0)
             .addHeader("header1", "stuff")
             .setHeader("header2", "more stuff")
             .setEntity(entity)
-            .setParams(params)
+            .setConfig(config)
             .build();
         Assert.assertNotNull(request);
         Assert.assertEquals("PUT", request.getMethod());
@@ -136,8 +136,8 @@ public class TestRequestBuilder {
         Assert.assertTrue(clone instanceof HttpEntityEnclosingRequest);
         Assert.assertNotNull(((HttpEntityEnclosingRequest) clone).getEntity());
         Assert.assertNotSame(entity, ((HttpEntityEnclosingRequest) clone).getEntity());
-        Assert.assertNotNull(clone.getParams());
-        Assert.assertNotSame(params, clone.getParams());
+        Assert.assertTrue(clone instanceof Configurable);
+        Assert.assertSame(config, ((Configurable) clone).getConfig());
     }
 
     @Test
@@ -151,7 +151,7 @@ public class TestRequestBuilder {
     @Test
     public void testGettersAndMutators() throws Exception {
         HttpEntity entity = new StringEntity("stuff");
-        HttpParams params = new BasicHttpParams();
+        RequestConfig config = RequestConfig.custom().build();
         Header h1 = new BasicHeader("header1", "stuff");
         Header h2 = new BasicHeader("header1", "more-stuff");
         RequestBuilder builder = RequestBuilder.createPut()
@@ -160,7 +160,7 @@ public class TestRequestBuilder {
             .addHeader(h1)
             .addHeader(h2)
             .setEntity(entity)
-            .setParams(params);
+            .setConfig(config);
         Assert.assertEquals("PUT", builder.getMethod());
         Assert.assertEquals(URI.create("/stuff"), builder.getUri());
         Assert.assertEquals(HttpVersion.HTTP_1_0, builder.getVersion());
@@ -168,7 +168,7 @@ public class TestRequestBuilder {
         Assert.assertSame(h2, builder.getLastHeader("header1"));
         Assert.assertEquals(2, builder.getHeaders("header1").length);
         Assert.assertSame(entity, builder.getEntity());
-        Assert.assertSame(params, builder.getParams());
+        Assert.assertSame(config, builder.getConfig());
 
         builder.setMethod(null)
             .setUri((String) null)
@@ -177,7 +177,7 @@ public class TestRequestBuilder {
             .removeHeaders("header1")
             .removeHeader(h2)
             .setEntity(null)
-            .setParams(null);
+            .setConfig(null);
         Assert.assertEquals(null, builder.getMethod());
         Assert.assertEquals(null, builder.getUri());
         Assert.assertEquals(null, builder.getVersion());
@@ -185,7 +185,7 @@ public class TestRequestBuilder {
         Assert.assertSame(null, builder.getLastHeader("header1"));
         Assert.assertEquals(0, builder.getHeaders("header1").length);
         Assert.assertSame(null, builder.getEntity());
-        Assert.assertSame(null, builder.getParams());
+        Assert.assertSame(null, builder.getConfig());
     }
 
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestAddCookies.java Wed Nov 28 13:45:06 2012
@@ -33,8 +33,8 @@ import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.client.CookieStore;
-import org.apache.http.client.params.AllClientPNames;
-import org.apache.http.client.params.CookiePolicy;
+import org.apache.http.client.config.CookieSpecs;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.config.Lookup;
 import org.apache.http.config.RegistryBuilder;
 import org.apache.http.conn.routing.HttpRoute;
@@ -84,12 +84,12 @@ public class TestRequestAddCookies {
         this.cookieStore.addCookie(cookie2);
 
         this.cookieSpecRegistry = RegistryBuilder.<CookieSpecProvider>create()
-            .register(CookiePolicy.BEST_MATCH, new BestMatchSpecFactory())
-            .register(CookiePolicy.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory())
-            .register(CookiePolicy.NETSCAPE, new NetscapeDraftSpecFactory())
-            .register(CookiePolicy.RFC_2109, new RFC2109SpecFactory())
-            .register(CookiePolicy.RFC_2965, new RFC2965SpecFactory())
-            .register(CookiePolicy.IGNORE_COOKIES, new IgnoreSpecFactory())
+            .register(CookieSpecs.BEST_MATCH, new BestMatchSpecFactory())
+            .register(CookieSpecs.BROWSER_COMPATIBILITY, new BrowserCompatSpecFactory())
+            .register(CookieSpecs.NETSCAPE, new NetscapeDraftSpecFactory())
+            .register(CookieSpecs.RFC_2109, new RFC2109SpecFactory())
+            .register(CookieSpecs.RFC_2965, new RFC2965SpecFactory())
+            .register(CookieSpecs.IGNORE_COOKIES, new IgnoreSpecFactory())
             .build();
     }
 
@@ -256,13 +256,14 @@ public class TestRequestAddCookies {
     @Test
     public void testAddCookiesUsingExplicitCookieSpec() throws Exception {
         HttpRequest request = new BasicHttpRequest("GET", "/");
-        request.getParams().setParameter(AllClientPNames.COOKIE_POLICY, CookiePolicy.BROWSER_COMPATIBILITY);
-
+        RequestConfig config = RequestConfig.custom()
+            .setCookieSpec(CookieSpecs.BROWSER_COMPATIBILITY).build();
         HttpRoute route = new HttpRoute(this.target, null, false);
 
         HttpContext context = new BasicHttpContext();
         context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
         context.setAttribute(ClientContext.ROUTE, route);
+        context.setAttribute(ClientContext.REQUEST_CONFIG, config);
         context.setAttribute(ClientContext.COOKIE_STORE, this.cookieStore);
         context.setAttribute(ClientContext.COOKIESPEC_REGISTRY, this.cookieSpecRegistry);
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java?rev=1414680&r1=1414679&r2=1414680&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/client/protocol/TestRequestDefaultHeaders.java Wed Nov 28 13:45:06 2012
@@ -34,7 +34,6 @@ import junit.framework.Assert;
 import org.apache.http.Header;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpRequestInterceptor;
-import org.apache.http.client.params.AllClientPNames;
 import org.apache.http.message.BasicHeader;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.protocol.BasicHttpContext;
@@ -55,10 +54,9 @@ public class TestRequestDefaultHeaders {
         HttpRequest request = new BasicHttpRequest("CONNECT", "www.somedomain.com");
         List<Header> defheaders = new ArrayList<Header>();
         defheaders.add(new BasicHeader("custom", "stuff"));
-        request.getParams().setParameter(AllClientPNames.DEFAULT_HEADERS, defheaders);
         HttpContext context = new BasicHttpContext();
 
-        HttpRequestInterceptor interceptor = new RequestDefaultHeaders();
+        HttpRequestInterceptor interceptor = new RequestDefaultHeaders(defheaders);
         interceptor.process(request, context);
         Header header1 = request.getFirstHeader("custom");
         Assert.assertNull(header1);
@@ -70,10 +68,9 @@ public class TestRequestDefaultHeaders {
         request.addHeader("custom", "stuff");
         List<Header> defheaders = new ArrayList<Header>();
         defheaders.add(new BasicHeader("custom", "more stuff"));
-        request.getParams().setParameter(AllClientPNames.DEFAULT_HEADERS, defheaders);
         HttpContext context = new BasicHttpContext();
 
-        HttpRequestInterceptor interceptor = new RequestDefaultHeaders();
+        HttpRequestInterceptor interceptor = new RequestDefaultHeaders(defheaders);
         interceptor.process(request, context);
         Header[] headers = request.getHeaders("custom");
         Assert.assertNotNull(headers);



Mime
View raw message