HI ,
 Thanks. Using something to trigger the download has worked. Thanks for your
help.
regards.


Claus Ibsen-2 wrote:
> 
> On Mon, Jun 7, 2010 at 5:57 PM, Nav1771 <navde...@yahoo.com> wrote:
>>
>> Hi willem ,
>>  Many thanks for the code. I tried a version of it. It is reading the
>> file
>> but instead of reading it once and downloading it in local folder it is
>> running into an infinite loop and creating many copies of the file.
>> Here  is the code.
>>
>>
>> from("http://testServer.com/DOTNET/default.aspx?jobno=ZXTR";).to("file:///E:/test4/?autoCreate=true");
>> the http path here streams XML content which should be written in a file
>> in
>> the E:/test4 folder. It does that but goes into an infinite loop doing
>> it.
>>
> 
> That is because you are using a polling consumer EIP pattern
> http://camel.apache.org/polling-consumer.html
> 
> Which causes Camel to invoke the http service infinitive loop.
> 
> So you may want to use a timer component to trigger how often you want
> to invoke that http service
> http://camel.apache.org/timer.html
> 
> You need something like this
> from(timer).to(http).to(file);
> 
> 
> Or maybe some other event needs to trigger when to download the file
> 
> 
>>
>>
>>
>> willem.jiang wrote:
>>>
>>> Hi,
>>>
>>> How did you send the request message to "direct:start"?
>>> I just wrote a simple test and ran it without any issue.
>>> Here is the route that I use,
>>>
>>> from("direct:start").setHeader(Exchange.HTTP_METHOD, constant("GET"))
>>>
>>> .to("http://jnn.javaeye.com/blog/458192";).setHeader(Exchange.FILE_NAME,
>>> constant("myfile.txt")).to("mock:results")
>>> .to("file://target/temp/?autoCreate=true");
>>>
>>> And I just send a null message body to the "direct:start".
>>>
>>> template.sendBody("direct:start", null);
>>>
>>> Willem
>>>
>>>
>>> Nav1771 wrote:
>>>> Thanks William,
>>>>      I tried the GET method but it still gave the same results.
>>>> regards,
>>>>
>>>>
>>>> willem.jiang wrote:
>>>>> Hi,
>>>>>
>>>>> Maybe you should try to use GET method instead of the POST method to
>>>>> get
>>>>> the file.
>>>>>
>>>>> Willem
>>>>>
>>>>> Nav1771 wrote:
>>>>>> Hi,
>>>>>>  I am a beginner with Camel. I am trying to download a file for which
>>>>>> I
>>>>>> have
>>>>>> http path and trying to store the file in the local file system.  I
>>>>>> am
>>>>>> using
>>>>>> Camel 2.3.0. Please see the code below.  I am expecting that on
>>>>>> running
>>>>>> this
>>>>>> route the file should be downloaded and moved to data2/s124 folder on
>>>>>> the
>>>>>> local filesystem. But this is not happening. Please let me know if I
>>>>>> am
>>>>>> doing anything wrong or if there is a better way of achieving this.
>>>>>> Btw
>>>>>> I
>>>>>> am
>>>>>> using camel-jetty component for the http action.
>>>>>>
>>>>>>
>>>>>> <route>
>>>>>>             <from uri="direct:start"/>
>>>>>>                 <setHeader headerName="CamelHttpMethod">
>>>>>>                     <constant>POST</constant>
>>>>>>                 </setHeader>
>>>>>>             <to uri="http://fileServer/11/trial1.txt"/>
>>>>>>             <to uri="file:///E:/data2/s124/?autoCreate=true"/>
>>>>>>         </route>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Using-CamelHttpComponent-to-download-file-tp28765063p28807168.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Using-CamelHttpComponent-to-download-file-tp28765063p28818134.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to