You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Leen Toelen (JIRA)" <ji...@apache.org> on 2010/02/16 22:44:39 UTC

[jira] Created: (CAMEL-2475) HTTP (Stream) to File only writes part of InputStream to File

HTTP (Stream) to File only writes part of InputStream to File
-------------------------------------------------------------

                 Key: CAMEL-2475
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2475
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-http
    Affects Versions: 2.1.0
            Reporter: Leen Toelen
            Priority: Minor


The follwoing route only writes part of the http input stream to the file output (always
in chunks of 1,2,4 or 8KB).:

               <route id="RestToTempDir">
                       <from uri="jetty:http://0.0.0.0:8162/muyrl" />
                       <setHeader headerName="CamelFileExchangeFile">
                               <header>message.id</header>
                       </setHeader>
                       <to
                               uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" />
                       <setBody>
                               <header>CamelFileExchangeFile</header>
                       </setBody>
               </route>

There are workarounds, but I would change streams to always read until EOF (if possible)

Possible workaround 1:
<convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing.

Possible workaround 2 is to write to a queue first

               <route id="RestToTempDir">
                       <from uri="jetty:http://0.0.0.0:8162/myurl" />
                       <inOnly uri="activemq:topic=TempTopic" />
                       <setBody>
                               <header>message.id</header>
                       </setBody>
                       <setHeader headerName="CamelFileExchangeFile">
                               <header>message.id</header>
                       </setHeader>
               </route>
               <route id="TempAssemblyToTempArchiveDirectory">
                       <from uri="activemq:topic:TempTopic" />
                       <setHeader headerName="CamelFileExchangeFile">
                               <header>message.id</header>
                       </setHeader>
                       <to
                               uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/>
               </route>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-2475) HTTP (Stream) to File only writes part of InputStream to File

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-2475:
-----------------------------------

    Assignee: Willem Jiang

> HTTP (Stream) to File only writes part of InputStream to File
> -------------------------------------------------------------
>
>                 Key: CAMEL-2475
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2475
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.1.0
>            Reporter: Leen Toelen
>            Assignee: Willem Jiang
>            Priority: Minor
>
> The follwoing route only writes part of the http input stream to the file output (always
> in chunks of 1,2,4 or 8KB).:
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/muyrl" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" />
>                        <setBody>
>                                <header>CamelFileExchangeFile</header>
>                        </setBody>
>                </route>
> There are workarounds, but I would change streams to always read until EOF (if possible)
> Possible workaround 1:
> <convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing.
> Possible workaround 2 is to write to a queue first
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/myurl" />
>                        <inOnly uri="activemq:topic=TempTopic" />
>                        <setBody>
>                                <header>message.id</header>
>                        </setBody>
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                </route>
>                <route id="TempAssemblyToTempArchiveDirectory">
>                        <from uri="activemq:topic:TempTopic" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/>
>                </route>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2475) HTTP (Stream) to File only writes part of InputStream to File

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58407#action_58407 ] 

Willem Jiang commented on CAMEL-2475:
-------------------------------------

Hi Leen,

I just added [an unit test|http://svn.apache.org/viewvc?rev=926956&view=rev] to reproduce the bug that you showed, it looks CAMEL-2551 already fix the issue that you found.
So please try out the latest Camel 2.3.0 snapshot for it.

> HTTP (Stream) to File only writes part of InputStream to File
> -------------------------------------------------------------
>
>                 Key: CAMEL-2475
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2475
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.1.0
>            Reporter: Leen Toelen
>            Assignee: Willem Jiang
>             Fix For: 2.3.0
>
>
> The follwoing route only writes part of the http input stream to the file output (always
> in chunks of 1,2,4 or 8KB).:
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/muyrl" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" />
>                        <setBody>
>                                <header>CamelFileExchangeFile</header>
>                        </setBody>
>                </route>
> There are workarounds, but I would change streams to always read until EOF (if possible)
> Possible workaround 1:
> <convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing.
> Possible workaround 2 is to write to a queue first
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/myurl" />
>                        <inOnly uri="activemq:topic=TempTopic" />
>                        <setBody>
>                                <header>message.id</header>
>                        </setBody>
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                </route>
>                <route id="TempAssemblyToTempArchiveDirectory">
>                        <from uri="activemq:topic:TempTopic" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/>
>                </route>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-2475) HTTP (Stream) to File only writes part of InputStream to File

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang updated CAMEL-2475:
--------------------------------

         Priority: Major  (was: Minor)
    Fix Version/s: 2.3.0

> HTTP (Stream) to File only writes part of InputStream to File
> -------------------------------------------------------------
>
>                 Key: CAMEL-2475
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2475
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.1.0
>            Reporter: Leen Toelen
>            Assignee: Willem Jiang
>             Fix For: 2.3.0
>
>
> The follwoing route only writes part of the http input stream to the file output (always
> in chunks of 1,2,4 or 8KB).:
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/muyrl" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" />
>                        <setBody>
>                                <header>CamelFileExchangeFile</header>
>                        </setBody>
>                </route>
> There are workarounds, but I would change streams to always read until EOF (if possible)
> Possible workaround 1:
> <convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing.
> Possible workaround 2 is to write to a queue first
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/myurl" />
>                        <inOnly uri="activemq:topic=TempTopic" />
>                        <setBody>
>                                <header>message.id</header>
>                        </setBody>
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                </route>
>                <route id="TempAssemblyToTempArchiveDirectory">
>                        <from uri="activemq:topic:TempTopic" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/>
>                </route>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2475) HTTP (Stream) to File only writes part of InputStream to File

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58323#action_58323 ] 

Willem Jiang commented on CAMEL-2475:
-------------------------------------

Hi Leen,

Can you try out the latest Camel 2.3.0 snapshot to see if the bug still there?
As we just applied a patch of CAMEL-2551 into the Came trunk. I think it could also fix the issue that you meet.




> HTTP (Stream) to File only writes part of InputStream to File
> -------------------------------------------------------------
>
>                 Key: CAMEL-2475
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2475
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.1.0
>            Reporter: Leen Toelen
>            Assignee: Willem Jiang
>             Fix For: 2.3.0
>
>
> The follwoing route only writes part of the http input stream to the file output (always
> in chunks of 1,2,4 or 8KB).:
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/muyrl" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" />
>                        <setBody>
>                                <header>CamelFileExchangeFile</header>
>                        </setBody>
>                </route>
> There are workarounds, but I would change streams to always read until EOF (if possible)
> Possible workaround 1:
> <convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing.
> Possible workaround 2 is to write to a queue first
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/myurl" />
>                        <inOnly uri="activemq:topic=TempTopic" />
>                        <setBody>
>                                <header>message.id</header>
>                        </setBody>
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                </route>
>                <route id="TempAssemblyToTempArchiveDirectory">
>                        <from uri="activemq:topic:TempTopic" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/>
>                </route>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-2475) HTTP (Stream) to File only writes part of InputStream to File

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-2475.
---------------------------------

    Resolution: Fixed

> HTTP (Stream) to File only writes part of InputStream to File
> -------------------------------------------------------------
>
>                 Key: CAMEL-2475
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2475
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.1.0
>            Reporter: Leen Toelen
>            Assignee: Willem Jiang
>             Fix For: 2.3.0
>
>
> The follwoing route only writes part of the http input stream to the file output (always
> in chunks of 1,2,4 or 8KB).:
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/muyrl" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/temp/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml" />
>                        <setBody>
>                                <header>CamelFileExchangeFile</header>
>                        </setBody>
>                </route>
> There are workarounds, but I would change streams to always read until EOF (if possible)
> Possible workaround 1:
> <convertBodyTo type="java.lang.String"/> to force it to convert the stream to string before writing.
> Possible workaround 2 is to write to a queue first
>                <route id="RestToTempDir">
>                        <from uri="jetty:http://0.0.0.0:8162/myurl" />
>                        <inOnly uri="activemq:topic=TempTopic" />
>                        <setBody>
>                                <header>message.id</header>
>                        </setBody>
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                </route>
>                <route id="TempAssemblyToTempArchiveDirectory">
>                        <from uri="activemq:topic:TempTopic" />
>                        <setHeader headerName="CamelFileExchangeFile">
>                                <header>message.id</header>
>                        </setHeader>
>                        <to
>                                uri="file://c:/xmlarchive_noxslt/?fileName=${date:now:yyyyMMdd}/asm-${id}.xml"/>
>                </route>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.