Return-Path: Delivered-To: apmail-jakarta-httpcomponents-commits-archive@www.apache.org Received: (qmail 39741 invoked from network); 14 May 2007 08:42:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 May 2007 08:42:31 -0000 Received: (qmail 28348 invoked by uid 500); 14 May 2007 08:42:38 -0000 Delivered-To: apmail-jakarta-httpcomponents-commits-archive@jakarta.apache.org Received: (qmail 28333 invoked by uid 500); 14 May 2007 08:42:38 -0000 Mailing-List: contact httpcomponents-commits-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: httpcomponents-dev@jakarta.apache.org Delivered-To: mailing list httpcomponents-commits@jakarta.apache.org Received: (qmail 28319 invoked by uid 99); 14 May 2007 08:42:38 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2007 01:42:38 -0700 X-ASF-Spam-Status: No, hits=-99.3 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME,SUBJECT_NOVOWEL X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2007 01:42:30 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id B5B901A9838; Mon, 14 May 2007 01:42:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r537750 - in /jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http: client/params/HttpClientParams.java impl/client/DefaultHttpClient.java Date: Mon, 14 May 2007 08:42:10 -0000 To: httpcomponents-commits@jakarta.apache.org From: olegk@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070514084210.B5B901A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: olegk Date: Mon May 14 01:42:09 2007 New Revision: 537750 URL: http://svn.apache.org/viewvc?view=rev&rev=537750 Log: Added default host and default proxy parameters HTTP client can fall back onto when determining request route Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/client/params/HttpClientParams.java jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/impl/client/DefaultHttpClient.java Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/client/params/HttpClientParams.java URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/client/params/HttpClientParams.java?view=diff&rev=537750&r1=537749&r2=537750 ============================================================================== --- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/client/params/HttpClientParams.java (original) +++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/client/params/HttpClientParams.java Mon May 14 01:42:09 2007 @@ -61,14 +61,6 @@ */ public static final String CONNECTION_MANAGER_FACTORY = "http.connection-manager.factory"; - /** - * Defines whether authentication should be attempted preemptively. - *

- * This parameter expects a value of type {@link Boolean}. - *

- */ - public static final String PREEMPTIVE_AUTHENTICATION = "http.authentication.preemptive"; - /** * Defines whether redirects should be handled automatically *

@@ -105,6 +97,22 @@ public static final String ALLOW_CIRCULAR_REDIRECTS = "http.protocol.allow-circular-redirects"; /** + * Defines whether authentication should be handled automatically. + *

+ * This parameter expects a value of type {@link Boolean}. + *

+ */ + public static final String HANDLE_AUTHENTICATION = "http.protocol.handle-authentication"; + + /** + * Defines whether authentication should be attempted preemptively. + *

+ * This parameter expects a value of type {@link Boolean}. + *

+ */ + public static final String PREEMPTIVE_AUTHENTICATION = "http.protocol.authentication-preemptive"; + + /** * Defines the name of the cookie specification to be used for HTTP state management. *

* This parameter expects a value of type {@link String}. @@ -121,6 +129,24 @@ */ public static final String DEFAULT_HEADERS = "http.default-headers"; + /** + * Defines the default host. The default value will be used if the target host is + * not explicitly specified in the request URI. + *

+ * This parameter expects a value of type {@link HttpHost}. + *

+ */ + public static final String DEFAULT_HOST = "http.default-host"; + + /** + * Defines the default proxy. The default value will be used if the proxy + * information is not explicitly specified in the request route. + *

+ * This parameter expects a value of type {@link HttpHost}. + *

+ */ + public static final String DEFAULT_PROXY = "http.default-proxy"; + private HttpClientParams() { super(); } Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/impl/client/DefaultHttpClient.java URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/impl/client/DefaultHttpClient.java?view=diff&rev=537750&r1=537749&r2=537750 ============================================================================== --- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/impl/client/DefaultHttpClient.java (original) +++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/impl/client/DefaultHttpClient.java Mon May 14 01:42:09 2007 @@ -244,18 +244,23 @@ HttpContext context) throws HttpException { - //@@@ refer to a default HostConfiguration? - //@@@ allow null target if there is a default route with a target? if (target == null) { - throw new IllegalArgumentException + target = (HttpHost) request.getParams().getParameter( + HttpClientParams.DEFAULT_HOST); + } + if (target == null) { + throw new IllegalStateException ("Target host must not be null."); } + HttpHost proxy = (HttpHost) request.getParams().getParameter( + HttpClientParams.DEFAULT_PROXY); + Scheme schm = getConnectionManager().getSchemeRegistry(). getScheme(target.getSchemeName()); // as it is typically used for TLS/SSL, we assume that // a layered scheme implies a secure connection - HttpRoute route = new HttpRoute(target, null, schm.isLayered()); + HttpRoute route = new HttpRoute(target, null, proxy, schm.isLayered()); return new RoutedRequest.Impl(request, route); }