Author: ningjiang
Date: Wed Sep 28 09:08:34 2011
New Revision: 1176792

URL: http://svn.apache.org/viewvc?rev=1176792&view=rev
Log:
Merged revisions 1176787 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.8.x

................
  r1176787 | ningjiang | 2011-09-28 16:58:44 +0800 (Wed, 28 Sep 2011) | 13 lines
  
  Merged revisions 1176781-1176782 via svnmerge from 
  https://svn.apache.org/repos/asf/camel/trunk
  
  ........
    r1176781 | ningjiang | 2011-09-28 16:23:35 +0800 (Wed, 28 Sep 2011) | 1 line
    
    CAMEL-4497 HttpPollingConsumer Get URL should support the property place 
holders as HttpProducer does
  ........
    r1176782 | ningjiang | 2011-09-28 16:27:15 +0800 (Wed, 28 Sep 2011) | 1 line
    
    CAMEL-4489, CAMEL-4497 fixed the camel-http4 proxy url issue
  ........
................

Modified:
    camel/branches/camel-2.7.x/   (props changed)
    
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
   (props changed)
    
camel/branches/camel-2.7.x/camel-core/src/test/java/org/apache/camel/component/file/GenericFileConverterTest.java
   (props changed)
    
camel/branches/camel-2.7.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
    
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
    
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpPollingConsumer.java
    
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
    
camel/branches/camel-2.7.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java

Propchange: camel/branches/camel-2.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 28 09:08:34 2011
@@ -1,2 +1,2 @@
-/camel/branches/camel-2.8.x:1174571,1175323,1176329
-/camel/trunk:1146608,1146903,1147216,1174565,1175321,1176274
+/camel/branches/camel-2.8.x:1174571,1175323,1176329,1176787
+/camel/trunk:1146608,1146903,1147216,1174565,1175321,1176274,1176781-1176782

Propchange: camel/branches/camel-2.7.x/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Sep 28 09:08:34 2011
@@ -1 +1 @@
-/camel/branches/camel-2.8.x:1-1146127,1146608,1146653,1146771,1146903,1147216,1174571,1175323,1176329
+/camel/branches/camel-2.8.x:1-1146127,1146608,1146653,1146771,1146903,1147216,1174571,1175323,1176329,1176787

Propchange: 
camel/branches/camel-2.7.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 28 09:08:34 2011
@@ -1,2 +1,2 @@
-/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java:1174571,1175323
+/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java:1174571,1175323,1176787
 
/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java:1124595

Propchange: 
camel/branches/camel-2.7.x/camel-core/src/test/java/org/apache/camel/component/file/GenericFileConverterTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 28 09:08:34 2011
@@ -1,2 +1,2 @@
-/camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/component/file/GenericFileConverterTest.java:1174571,1175323
+/camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/component/file/GenericFileConverterTest.java:1174571,1175323,1176787
 
/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/GenericFileConverterTest.java:1124595

Modified: 
camel/branches/camel-2.7.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java?rev=1176792&r1=1176791&r2=1176792&view=diff
==============================================================================
--- 
camel/branches/camel-2.7.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
 (original)
+++ 
camel/branches/camel-2.7.x/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java
 Wed Sep 28 09:08:34 2011
@@ -58,7 +58,7 @@ public class HttpPollingConsumer extends
 
     protected Exchange doReceive(int timeout) {
         Exchange exchange = endpoint.createExchange();
-        HttpMethod method = createMethod();
+        HttpMethod method = createMethod(exchange);
 
         // set optional timeout in millis
         if (timeout > 0) {
@@ -111,8 +111,8 @@ public class HttpPollingConsumer extends
 
     // Implementation methods
     //-------------------------------------------------------------------------
-    protected HttpMethod createMethod() {
-        String uri = endpoint.getEndpointUri();
+    protected HttpMethod createMethod(Exchange exchange) {
+        String uri = HttpHelper.createURL(exchange, endpoint);
         return new GetMethod(uri);
     }
 

Modified: 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java?rev=1176792&r1=1176791&r2=1176792&view=diff
==============================================================================
--- 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 (original)
+++ 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 Wed Sep 28 09:08:34 2011
@@ -177,7 +177,15 @@ public class HttpComponent extends Heade
         HttpClientConfigurer configurer = 
createHttpClientConfigurer(parameters);
         URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), 
CastUtils.cast(httpClientParameters));
         // 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(addressUri), 
CastUtils.cast(parameters));
+        // The httpUri should be start with http or https
+        String httpUriAddress = addressUri;
+        if (addressUri.startsWith("http4")) {
+            httpUriAddress = "http" + addressUri.substring(5);
+        }
+        if (addressUri.startsWith("https4")) {
+            httpUriAddress = "https" + addressUri.substring(6);
+        }
+        URI httpUri = URISupport.createRemainingURI(new URI(httpUriAddress), 
CastUtils.cast(parameters));
 
         // validate http uri that end-user did not duplicate the http part 
that can be a common error
         String part = httpUri.getSchemeSpecificPart();

Modified: 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpPollingConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpPollingConsumer.java?rev=1176792&r1=1176791&r2=1176792&view=diff
==============================================================================
--- 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpPollingConsumer.java
 (original)
+++ 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpPollingConsumer.java
 Wed Sep 28 09:08:34 2011
@@ -62,7 +62,7 @@ public class HttpPollingConsumer extends
 
     protected Exchange doReceive(int timeout) {
         Exchange exchange = endpoint.createExchange();
-        HttpRequestBase method = createMethod();
+        HttpRequestBase method = createMethod(exchange);
 
         // set optional timeout in millis
         if (timeout > 0) {
@@ -125,8 +125,8 @@ public class HttpPollingConsumer extends
     // Implementation methods
     //-------------------------------------------------------------------------
 
-    protected HttpRequestBase createMethod() {
-        String uri = endpoint.getEndpointUri();
+    protected HttpRequestBase createMethod(Exchange exchange) {
+        String uri = HttpHelper.createURL(exchange, endpoint);
         return new HttpGet(uri);
     }
 

Modified: 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java?rev=1176792&r1=1176791&r2=1176792&view=diff
==============================================================================
--- 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
 (original)
+++ 
camel/branches/camel-2.7.x/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
 Wed Sep 28 09:08:34 2011
@@ -289,13 +289,7 @@ public class HttpProducer extends Defaul
                     + ". If you are forwarding/bridging http endpoints, then 
enable the bridgeEndpoint option on the endpoint: " + getEndpoint());
         }
         
-        // Changed the schema to http4 to normal http by default
-        String schema = "http";
-        if (uri.getScheme().equals("https4")) {
-            schema = "https";
-        }
-        
-        StringBuilder builder = new 
StringBuilder(schema).append("://").append(uri.getHost());
+        StringBuilder builder = new 
StringBuilder(uri.getScheme()).append("://").append(uri.getHost());
 
         if (uri.getPort() != -1) {
             builder.append(":").append(uri.getPort());

Modified: 
camel/branches/camel-2.7.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.7.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java?rev=1176792&r1=1176791&r2=1176792&view=diff
==============================================================================
--- 
camel/branches/camel-2.7.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
 (original)
+++ 
camel/branches/camel-2.7.x/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
 Wed Sep 28 09:08:34 2011
@@ -182,6 +182,15 @@ public class HttpProxyServerTest extends
 
         assertExchange(exchange);
     }
+    
+    public void httpGetPullEndpointWithProxyAndWithUser() {
+        proxy.register("*", new ProxyAuthenticationValidationHandler("GET", 
null, null, getExpectedContent(), user, password));
+
+        Exchange exchange = consumer.receive("http4://" + getHostName() + ":" 
+ getPort() + "?proxyAuthHost="
+                + getProxyHost() + "&proxyAuthPort=" + getProxyPort() + 
"&proxyAuthUsername=camel&proxyAuthPassword=password");
+
+        assertExchange(exchange);
+    }
 
     private String getProxyHost() {
         return proxy.getServiceAddress().getHostName();
@@ -194,7 +203,12 @@ public class HttpProxyServerTest extends
     class RequestProxyBasicAuth implements HttpRequestInterceptor {
         public void process(final HttpRequest request, final HttpContext 
context) throws HttpException, IOException {
             String auth = null;
-
+            
+            String requestLine = request.getRequestLine().toString();
+            // assert we set a write GET URI
+            if (requestLine.contains("http4://localhost")) {
+                throw new HttpException("Get a wrong proxy GET url");
+            }
             Header h = request.getFirstHeader(AUTH.PROXY_AUTH_RESP);
             if (h != null) {
                 String s = h.getValue();


Reply via email to