Re: S3 route problem when access key and secret key are in URI

2015-01-10 Thread Shing Hing Man
It works after I wrap my secret key with RAW.
Thanks!
Shing 
 

 On Saturday, 10 January 2015, 7:01, Willem Jiang willem.ji...@gmail.com 
wrote:
   

 You can use raw()[1] to wrap the access key and secret key to avoid the 
encoding of URI.

[1]https://camel.apache.org/configuring-camel.html#ConfiguringCamel-Configuringparametervaluesusingrawvalues,egsuchaspasswords

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 10, 2015 at 5:02:14 AM, Shing Hing Man (mat...@yahoo.com.invalid) 
wrote:
  
 I am using Camel 2.14.1
 When I build a S3 route and specify the accessKey and secretKey in the URI, I 
 got the following  
 exception.(Note that I have URL encoded my secret key so that + is replaced 
 by %2B.  
 )
 String awsURLTemplate=aws-s3://%s?accessKey=%ssecretKey=%s®ion=eu-west-1;  
 final String awsURL = String.format(awsURLTemplate,bucketName, 
 accessKey,secretKey);  
 DefaultCamelContext context = new DefaultCamelContext(); 
 context.addRoutes(new  
 RouteBuilder() { public void configure() { 
 from(direct:start).to(awsURL).to(stream:out);  
 } });
  
 Exception in thread main org.apache.camel.FailedToCreateRouteException: 
 Failed  
 to create route route1 at:  
 To[aws-s3://myBucket?accessKey=***secretKey=***®ion=eu-west-1]  
  in route: Route(route1)[[From[direct:start]] - [To[aws-s3://... because 
 of  
 Failed to resolve endpoint: 
 aws-s3://myBucket?accessKey=***®ion=eu-west-1secretKey=  
 due to: The request signature we calculated does not match the signature you 
 provided.  
 Check your key and signing method. (Service: Amazon S3; Status Code: 403; 
 Error Code:  
 SignatureDoesNotMatch; Request ID: C227F0C1D0D16660) at 
 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945)  
 at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187) 
  
 at 
 org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:805)
   
 at 
 org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2174)
   
 at 
 org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1906)
   
 at 
 org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1767)
   
 at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)  
 at 
 org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1735)
   
 at net.sf.camel.s3.S3Demo2.run(S3Demo2.java:58)
  
 But it works if the accessKey and secretKey are specified in a registry as 
 described in  
 http://camel.apache.org/aws-s3.html Thanks in advance for any assistance !
 Shing
  


   

Re: S3 route problem when access key and secret key are in URI

2015-01-09 Thread Willem Jiang
You can use raw()[1] to wrap the access key and secret key to avoid the 
encoding of URI.

[1]https://camel.apache.org/configuring-camel.html#ConfiguringCamel-Configuringparametervaluesusingrawvalues,egsuchaspasswords

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 10, 2015 at 5:02:14 AM, Shing Hing Man (mat...@yahoo.com.invalid) 
wrote:
  
 I am using Camel 2.14.1
 When I build a S3 route and specify the accessKey and secretKey in the URI, I 
 got the following  
 exception.(Note that I have URL encoded my secret key so that + is replaced 
 by %2B.  
 )
 String awsURLTemplate=aws-s3://%s?accessKey=%ssecretKey=%s®ion=eu-west-1;  
 final String awsURL = String.format(awsURLTemplate,bucketName, 
 accessKey,secretKey);  
 DefaultCamelContext context = new DefaultCamelContext(); 
 context.addRoutes(new  
 RouteBuilder() { public void configure() { 
 from(direct:start).to(awsURL).to(stream:out);  
 } });
  
 Exception in thread main org.apache.camel.FailedToCreateRouteException: 
 Failed  
 to create route route1 at:  
 To[aws-s3://myBucket?accessKey=***secretKey=***®ion=eu-west-1]  
  in route: Route(route1)[[From[direct:start]] - [To[aws-s3://... because 
 of  
 Failed to resolve endpoint: 
 aws-s3://myBucket?accessKey=***®ion=eu-west-1secretKey=  
 due to: The request signature we calculated does not match the signature you 
 provided.  
 Check your key and signing method. (Service: Amazon S3; Status Code: 403; 
 Error Code:  
 SignatureDoesNotMatch; Request ID: C227F0C1D0D16660) at 
 org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945)  
 at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187) 
  
 at 
 org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:805)
   
 at 
 org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2174)
   
 at 
 org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1906)
   
 at 
 org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1767)
   
 at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)  
 at 
 org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1735)
   
 at net.sf.camel.s3.S3Demo2.run(S3Demo2.java:58)
  
 But it works if the accessKey and secretKey are specified in a registry as 
 described in  
 http://camel.apache.org/aws-s3.html Thanks in advance for any assistance !
 Shing
  



S3 route problem when access key and secret key are in URI

2015-01-09 Thread Shing Hing Man

I am using Camel 2.14.1 
When I build a S3 route and specify the accessKey and secretKey in the URI, I 
got the following exception.(Note that I have URL encoded my secret key so that 
+ is replaced by %2B. )
String awsURLTemplate=aws-s3://%s?accessKey=%ssecretKey=%sregion=eu-west-1; 
final String awsURL = String.format(awsURLTemplate,bucketName, 
accessKey,secretKey);  DefaultCamelContext context = new DefaultCamelContext(); 
  context.addRoutes(new RouteBuilder() { public void configure() {  
from(direct:start).to(awsURL).to(stream:out); } });

Exception in thread main org.apache.camel.FailedToCreateRouteException: 
Failed to create route route1 at:  
To[aws-s3://myBucket?accessKey=***secretKey=***region=eu-west-1]  in 
route: Route(route1)[[From[direct:start]] - [To[aws-s3://... because of Failed 
to resolve endpoint: 
aws-s3://myBucket?accessKey=***region=eu-west-1secretKey= due to: The 
request signature we calculated does not match the signature you provided. 
Check your key and signing method. (Service: Amazon S3; Status Code: 403; Error 
Code: SignatureDoesNotMatch; Request ID: C227F0C1D0D16660) at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:945) at 
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:187) at 
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:805)
 at 
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:2174)
 at 
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1906)
 at 
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1767)
 at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at 
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1735) 
at net.sf.camel.s3.S3Demo2.run(S3Demo2.java:58)

But it works  if the accessKey and secretKey are specified in a registry as 
described in  http://camel.apache.org/aws-s3.html Thanks in advance for any 
assistance !
Shing