camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bengt Rodehav <be...@rodehav.com>
Subject Re: Cannot change directory to: ". Code: 550 on FTP component
Date Tue, 25 Jun 2013 11:09:39 GMT
OK - you use "recursive=true". I meant specifying a specific subdirectory
without the "recursive=true", e g:

from("ftp://host.com/subdir?password=tiktak&binary=true&consumer.delay=10000<ftp://host.com/?password=tiktak&binary=true&consumer.delay=10000&recursive=true>
")

Does that also work? Are you using Camel 2.11.0?

/Bengt




2013/6/25 lassesvestergaard <lassesvestergaard@gmail.com>

> Hi Bengt.
>
> Yes, I'm able to specify a subfolder in my URI.
> As far as I can see, it works fine as a producer if I specify a subfolder.
>
> What I have ended up doing is:
>
> from("
> ftp://host.com?password=tiktak&binary=true&consumer.delay=10000&recursive=true
> ")
>                 .to("file://inbox");
>         from("file://inbox?recursive=true&idempotent=true")
>                 .process(
>                 new Processor() {
>             @Override
>             public void process(Exchange exchange) throws Exception {
>                 String resourceID="";
>                 JSONArray ja=new JSONArray();
>
>                 GenericFile body = (GenericFile)
> exchange.getIn().getBody();
>                 File f = (File) body.getFile();
>                 try (FileInputStream is = new FileInputStream(f)) {
>                     BufferedReader br = new BufferedReader(new
> InputStreamReader(is));
>
>                     if(f.getName().equals("bbr.csv")){
>                         resourceID="";
>                     }else{
>                         resourceID="";
>                     }
>
>                     String[] headlines=null;
>                     String[] datalines=null;
>                     String strLine;
>                     int i=0;
>                     while ((strLine = br.readLine()) != null) {
>                         if(i==0){
>                             headlines=strLine.split(",");
>                         }else{
>                             datalines=strLine.split(",");
>                             JSONObject jo=new JSONObject();
>                             for (int j=0; j<headlines.length;j++){
>                                 jo.put(headlines[j],datalines[j]);
>                             }
>                             ja.put(jo);
>                         }
>                         i++;
>                     }
>                 }
>
> exchange.getIn().setBody("{\"resource_id\":\""+resourceID+"\", \"records\":
> " + ja.toString() + ",\"method\":\"insert\"}");
>             }
>         }).setHeader("CamelHttpMethod", constant("POST"))
>          .setHeader("Authorization", constant("somenumbers"))
>          .to("http4://somehost");
>
> I havent tested the above code fully yet, but I think it work :-). Anyways,
> this is how I solve my problem, and I just want to show my code, so anyone
> with similar tasks can get inspiration.
>
> Thanks for your quick responses and help guys.
>
> Regards
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-change-directory-to-Code-550-on-FTP-component-tp5734612p5734725.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message