You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jan Bednář <ma...@janbednar.eu> on 2019/06/06 19:14:20 UTC

Re: Possible bug in netty-http - characters in body get unescaped?

Hello,
This is not about netty, but about Simple language. Simple language is 
not intended for static content. Camel does parsing of whole file while 
resolving simple placeholders in file content.
For this kind of usage you should use Constant language:
     <camel:setBody>
<camel:constant>resource:classpath:jquery.js</camel:constant>
     </camel:setBody>

Dne 5.6.2019 v 9:05 Martin.Scheffler@t-systems.com napsal(a):
> Hi all,
>
> I have this route to serve a static javascript file:
>
> <route id="jquery.js">
>      <from uri="netty4-http:http://0.0.0.0:8081/jquery.js"/>
>      <setHeader headerName="Content-Type">
>          <constant>text/javascript</constant>
>      </setHeader>
>      <camel:setBody>
>          <camel:simple>resource:classpath:jquery.js</camel:simple>
>      </camel:setBody>
> </route>
>
> The file is served when I open it in the browser, but it is not identical to the file on disk. There is a string in the jquery.js file that goes something like this:
>
> '\\t\\r\\n'
> Or in words, [backslash backslash t backslash backslash r backslash backslash n]
>
> The file that arrives in the browser does not contain these characters, but instead an actual line break is in that position.
> You can find the jquery file here:
> https://code.jquery.com/jquery-3.4.1.min.js
>
> Is this a bug or am I missing some parameter for my route?
>
> Thanks for your help!
>
> Cheers,
> Martin
>
>