You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chris <cw...@gmail.com> on 2013/08/21 16:00:10 UTC

Is there a bug with file:// endpoint, or user error?

When I try to use the "include" option when defining an SFTP endpoint, 
sometimes it works, other times the endpoint URI gets totally scrambled, 
depending on the regular express for "include". The point at which the 
URI gets scrambled is after URISupport.normalizeUri(uri)  is called.  I 
tried pre-URI-encoding the regular expression, but then it gets 
URI-encoded twice in that case.

Any ideas or corrections as to how I'm using the "include" option?

BTW, I this is a runtime-generated endpoint, so I can't use a 
GenericFileFilter<T> instance because I have yet to find an easy way to 
programmatically add objects to the Springframework bean factory (Camel 
registry) at runtime.

Thanks,

Chris

Parameters:
port=21000, binary=true, username=adpt5, host=localhost,
localWorkDirectory=target/res/tmp/local, idempotent=true, scheme=sftp,
directory=target/res/home, password=adpt5, move=archive/${file:name}, 
separator=UNIX,
include=(^[\w|\W&&[^_]]+)(_MKT_)(\d\d\d\d\d\d\d\d)(_(HISTORY))?(_(.[^\.]+))?\..+}

URI before  URISupport.normalizeUri(uri) is called:

sftp://localhost:21000?username=adpt5&binary=true&idempotent=true&localWorkDirectory=target%2Fres%2Ftmp%2Flocal&directory=target%2Fres%2Fhome&password=adpt5&separator=UNIX&move=archive%2F%24%7Bfile%3Aname%7D&include=%28%5E%5B%5Cw%7C%5CW%26%26%5B%5E_%5D%5D%2B%29%28_MKT_%29%28%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%29%28_%28HISTORY%29%29%3F%28_%28.%5B%5E%5C.%5D%2B%29%29%3F%5C..%2B

URI, scrambled after URISupport.normalizeUri(uri) is called:

Failed to resolve endpoint: 
sftp://localhost:21000?&%5B%5E_%5D%5D%2B%29%28_MKT_%29%28%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%29%28_%28HISTORY%29%29%3F%28_%28.%5B%5E%5C.%5D%2B%29%29%3F%5C..%2B&binary=true&directory=target%2Fres%2Fhome&idempotent=true&include=%28%5E%5B%5Cw%7C%5CW&localWorkDirectory=target%2Fres%2Ftmp%2Flocal&move=archive%2F%24%7Bfile%3Aname%7D&password=adpt5&separator=UNIX&username=adpt5 
due to: There are 2 parameters that couldn't be set on the endpoint. 
Check the uri if the parameters are spelt correctly and that they are 
properties of the endpoint. Unknown parameters=[{=null, 
[^_]]+)(_MKT_)(\d\d\d\d\d\d\d\d)(_(HISTORY))?(_(.[^\.]+))?\..+=null}


Re: Is there a bug with file:// endpoint, or user error?

Posted by Chris <cw...@gmail.com>.
Thanks, Claus - I vaguely was a aware there was something to handle 
password param values, I just didn't make the connection that it could 
be used generally to prevent URL encoding - I'll give that a try.

      -Chris

On 8/22/2013 2:34 AM, Claus Ibsen wrote:
> You can try use RAW for this big and ugly regexp
> http://camel.apache.org/how-do-i-configure-endpoints.html
>
> On Wed, Aug 21, 2013 at 4:00 PM, Chris <cw...@gmail.com> wrote:
>> When I try to use the "include" option when defining an SFTP endpoint,
>> sometimes it works, other times the endpoint URI gets totally scrambled,
>> depending on the regular express for "include". The point at which the URI
>> gets scrambled is after URISupport.normalizeUri(uri)  is called.  I tried
>> pre-URI-encoding the regular expression, but then it gets URI-encoded twice
>> in that case.
>>


Re: Is there a bug with file:// endpoint, or user error?

Posted by Claus Ibsen <cl...@gmail.com>.
You can try use RAW for this big and ugly regexp
http://camel.apache.org/how-do-i-configure-endpoints.html

On Wed, Aug 21, 2013 at 4:00 PM, Chris <cw...@gmail.com> wrote:
> When I try to use the "include" option when defining an SFTP endpoint,
> sometimes it works, other times the endpoint URI gets totally scrambled,
> depending on the regular express for "include". The point at which the URI
> gets scrambled is after URISupport.normalizeUri(uri)  is called.  I tried
> pre-URI-encoding the regular expression, but then it gets URI-encoded twice
> in that case.
>
> Any ideas or corrections as to how I'm using the "include" option?
>
> BTW, I this is a runtime-generated endpoint, so I can't use a
> GenericFileFilter<T> instance because I have yet to find an easy way to
> programmatically add objects to the Springframework bean factory (Camel
> registry) at runtime.
>
> Thanks,
>
> Chris
>
> Parameters:
> port=21000, binary=true, username=adpt5, host=localhost,
> localWorkDirectory=target/res/tmp/local, idempotent=true, scheme=sftp,
> directory=target/res/home, password=adpt5, move=archive/${file:name},
> separator=UNIX,
> include=(^[\w|\W&&[^_]]+)(_MKT_)(\d\d\d\d\d\d\d\d)(_(HISTORY))?(_(.[^\.]+))?\..+}
>
> URI before  URISupport.normalizeUri(uri) is called:
>
> sftp://localhost:21000?username=adpt5&binary=true&idempotent=true&localWorkDirectory=target%2Fres%2Ftmp%2Flocal&directory=target%2Fres%2Fhome&password=adpt5&separator=UNIX&move=archive%2F%24%7Bfile%3Aname%7D&include=%28%5E%5B%5Cw%7C%5CW%26%26%5B%5E_%5D%5D%2B%29%28_MKT_%29%28%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%29%28_%28HISTORY%29%29%3F%28_%28.%5B%5E%5C.%5D%2B%29%29%3F%5C..%2B
>
> URI, scrambled after URISupport.normalizeUri(uri) is called:
>
> Failed to resolve endpoint:
> sftp://localhost:21000?&%5B%5E_%5D%5D%2B%29%28_MKT_%29%28%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%5Cd%29%28_%28HISTORY%29%29%3F%28_%28.%5B%5E%5C.%5D%2B%29%29%3F%5C..%2B&binary=true&directory=target%2Fres%2Fhome&idempotent=true&include=%28%5E%5B%5Cw%7C%5CW&localWorkDirectory=target%2Fres%2Ftmp%2Flocal&move=archive%2F%24%7Bfile%3Aname%7D&password=adpt5&separator=UNIX&username=adpt5
> due to: There are 2 parameters that couldn't be set on the endpoint. Check
> the uri if the parameters are spelt correctly and that they are properties
> of the endpoint. Unknown parameters=[{=null,
> [^_]]+)(_MKT_)(\d\d\d\d\d\d\d\d)(_(HISTORY))?(_(.[^\.]+))?\..+=null}
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen