Return-Path: Delivered-To: apmail-activemq-camel-commits-archive@locus.apache.org Received: (qmail 55512 invoked from network); 3 Jan 2009 04:05:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jan 2009 04:05:41 -0000 Received: (qmail 82629 invoked by uid 500); 3 Jan 2009 04:05:41 -0000 Delivered-To: apmail-activemq-camel-commits-archive@activemq.apache.org Received: (qmail 82605 invoked by uid 500); 3 Jan 2009 04:05:40 -0000 Mailing-List: contact camel-commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-commits@activemq.apache.org Received: (qmail 82596 invoked by uid 99); 3 Jan 2009 04:05:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jan 2009 20:05:40 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 03 Jan 2009 04:05:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BD28723889A0; Fri, 2 Jan 2009 20:05:19 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r730903 - in /activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http: BasicAuthenticationHttpClientConfigurer.java HttpComponent.java Date: Sat, 03 Jan 2009 04:05:18 -0000 To: camel-commits@activemq.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090103040519.BD28723889A0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Fri Jan 2 20:05:17 2009 New Revision: 730903 URL: http://svn.apache.org/viewvc?rev=730903&view=rev Log: CAMEL-1214 Did a quick fix for basic authentication of camel-http Added: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java (with props) Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Added: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java?rev=730903&view=auto ============================================================================== --- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java (added) +++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java Fri Jan 2 20:05:17 2009 @@ -0,0 +1,24 @@ +package org.apache.camel.component.http; + +import org.apache.commons.httpclient.Credentials; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.UsernamePasswordCredentials; +import org.apache.commons.httpclient.auth.AuthScope; + +public class BasicAuthenticationHttpClientConfigurer implements HttpClientConfigurer { + private final String username; + private final String password; + + public BasicAuthenticationHttpClientConfigurer(String user, String pwd) { + username = user; + password = pwd; + } + + public void configureHttpClient(HttpClient client) { + + Credentials defaultcreds = new UsernamePasswordCredentials(username, password); + client.getState().setCredentials(AuthScope.ANY, defaultcreds); + + } + +} Propchange: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=730903&r1=730902&r2=730903&view=diff ============================================================================== --- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java (original) +++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java Fri Jan 2 20:05:17 2009 @@ -78,6 +78,12 @@ if (ref != null) { httpBinding = CamelContextHelper.mandatoryLookup(getCamelContext(), ref, HttpBinding.class); } + + // lookup http client front configurer in the registry if provided + ref = getAndRemoveParameter(parameters, "httpClientConfigurerRef", String.class); + if (ref != null) { + httpClientConfigurer = CamelContextHelper.mandatoryLookup(getCamelContext(), ref, HttpClientConfigurer.class); + } // restructure uri to be based on the parameters left as we dont want to include the Camel internal options URI httpUri = URISupport.createRemainingURI(new URI(uri), parameters);