title: Java : Downloading file from a remote location using sftp
body: <p>I have to  download a file which is in remote location using SFTP on clicking a hyperlink  . Am using JBOSS 5.1 as my Server and using struts2. I have implemented the below code and i found out the receiveBody() of the ConsumerTemplate is coming as null ?
  Can any one please guide me to the above issue ?</p>
  
  <p>Code :</p>
  
  <pre><code>CamelContext ctx = new DefaultCamelContext();
                  ConsumerTemplate consumer = ctx.createConsumerTemplate();
                  String camel_ftp_uri = MessageFormat.format(CAMEL_FTP_PATTERN, ftp_mode, ftp_user, ftp_address, ftp_dir, ftp_options);
                  System.out.println("camel_ftp_uri ::: "+camel_ftp_uri);
  
                  Object obj= consumer.receiveBody(camel_ftp_uri);
                  System.out.println("obj  ::"+obj);
  </code></pre>
  
  <p>when am printing the <code>camel_ftp_uri</code> am getting :camel_ftp_uri ::: </p>
  
  <p><code>ftp://ccc_uat1@1x.xxx.xx.xxx//from_ccc/file.txt?disconnect=true</code></p>
  
  <p>I refered the below link in SOF :</p>
  
  <p><a href="https://stackoverflow.com/questions/14617/java-what-is-the-best-way-to-sftp-a-file-from-a-server">How to retrieve a file from a server via SFTP?</a> </p>
  
  <p>Thanks in Advance </p>