You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rebecca Kreuter <al...@gmail.com> on 2014/09/24 04:03:54 UTC
Corrupt pdf from classpath
I am trying to return a pdf as a response to a GET request.
For the time being I would like to return a pdf from a file on the classpath.
I tried using <to
uri="language:constant:resource:classpath:sample.pdf" /> as indicated
by [0].
The file is coming through but it's been corrupted.
I tried convertBodyTo byte[] but I haven't gotten it to work.
Any thoughts?
Thank you.
[0] http://stackoverflow.com/a/16811930/1623533
Before:
%PDF-1.5
%âãÏÓ
After:
%PDF-1.5
%����
Re: Corrupt pdf from classpath
Posted by tsnell <tj...@snagdata.com>.
I've been planning on contributing the code and just hadn't bothered. Since
there's interest I'll go ahead and commit it.
--
View this message in context: http://camel.465427.n5.nabble.com/Corrupt-pdf-from-classpath-tp5756921p5757109.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Corrupt pdf from classpath
Posted by Tracy Snell <ts...@gmail.com>.
Always have planned on committing that component. Just never got to it. Since there’s interest I will.
tjs
On Sep 26, 2014, at 7:10 AM, scottdawson <sc...@gmail.com> wrote:
> Hi Claus,
> Tracy Snell wrote the original code and it's his website that I provided the
> link to in my earlier post. I will try to contact Tracy and see if he's
> willing to donate his code.
>
> Regards,
> Scott
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Corrupt-pdf-from-classpath-tp5756921p5757048.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Corrupt pdf from classpath
Posted by scottdawson <sc...@gmail.com>.
Hi Claus,
Tracy Snell wrote the original code and it's his website that I provided the
link to in my earlier post. I will try to contact Tracy and see if he's
willing to donate his code.
Regards,
Scott
--
View this message in context: http://camel.465427.n5.nabble.com/Corrupt-pdf-from-classpath-tp5756921p5757048.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Corrupt pdf from classpath
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Ah a nice component, maybe you would consider donate it to Apache
Camel so we can have it in the box?
On Thu, Sep 25, 2014 at 9:14 PM, scottdawson <sc...@gmail.com> wrote:
> Hello,
> I wrote a component based on the code shown here:
> http://code.notsoclever.cc/writing-camel-component-camel-static-resource/
> <http://code.notsoclever.cc/writing-camel-component-camel-static-resource/>
> to deliver static files, mostly PNG files in my case but I see no reason why
> it won't work for PDFs.
>
> The first code sample in the article gives everything needed to deliver
> static files and it detects the type of the file to set the HTTP
> Content-Type header correctly.
>
> Regards,
> Scott
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Corrupt-pdf-from-classpath-tp5756921p5757022.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: Corrupt pdf from classpath
Posted by scottdawson <sc...@gmail.com>.
Hello,
I wrote a component based on the code shown here:
http://code.notsoclever.cc/writing-camel-component-camel-static-resource/
<http://code.notsoclever.cc/writing-camel-component-camel-static-resource/>
to deliver static files, mostly PNG files in my case but I see no reason why
it won't work for PDFs.
The first code sample in the article gives everything needed to deliver
static files and it detects the type of the file to set the HTTP
Content-Type header correctly.
Regards,
Scott
--
View this message in context: http://camel.465427.n5.nabble.com/Corrupt-pdf-from-classpath-tp5756921p5757022.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Corrupt pdf from classpath
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah that was the case, I have logged a ticket to support this in the future
https://issues.apache.org/jira/browse/CAMEL-7859
On Wed, Sep 24, 2014 at 10:27 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> I think the language component reads the resource as text based. Not
> sure if there is some explicit String.class conversion in there. Would
> need to check the code.
>
>
>
> On Wed, Sep 24, 2014 at 4:03 AM, Rebecca Kreuter
> <al...@gmail.com> wrote:
>> I am trying to return a pdf as a response to a GET request.
>> For the time being I would like to return a pdf from a file on the classpath.
>> I tried using <to
>> uri="language:constant:resource:classpath:sample.pdf" /> as indicated
>> by [0].
>> The file is coming through but it's been corrupted.
>> I tried convertBodyTo byte[] but I haven't gotten it to work.
>> Any thoughts?
>> Thank you.
>>
>> [0] http://stackoverflow.com/a/16811930/1623533
>>
>> Before:
>> %PDF-1.5
>> %âãÏÓ
>>
>> After:
>> %PDF-1.5
>> %����
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: Corrupt pdf from classpath
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
I think the language component reads the resource as text based. Not
sure if there is some explicit String.class conversion in there. Would
need to check the code.
On Wed, Sep 24, 2014 at 4:03 AM, Rebecca Kreuter
<al...@gmail.com> wrote:
> I am trying to return a pdf as a response to a GET request.
> For the time being I would like to return a pdf from a file on the classpath.
> I tried using <to
> uri="language:constant:resource:classpath:sample.pdf" /> as indicated
> by [0].
> The file is coming through but it's been corrupted.
> I tried convertBodyTo byte[] but I haven't gotten it to work.
> Any thoughts?
> Thank you.
>
> [0] http://stackoverflow.com/a/16811930/1623533
>
> Before:
> %PDF-1.5
> %âãÏÓ
>
> After:
> %PDF-1.5
> %����
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Re: Corrupt pdf from classpath
Posted by Willem Jiang <wi...@gmail.com>.
Can you post the whole camel route?
Maybe you need to setup the content-type header to avoid camel do the encoding work for you.
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On September 24, 2014 at 10:04:21 AM, Rebecca Kreuter (alilyamongthorns@gmail.com) wrote:
> I am trying to return a pdf as a response to a GET request.
> For the time being I would like to return a pdf from a file on the classpath.
> I tried using > uri="language:constant:resource:classpath:sample.pdf" /> as indicated
> by [0].
> The file is coming through but it's been corrupted.
> I tried convertBodyTo byte[] but I haven't gotten it to work.
> Any thoughts?
> Thank you.
>
> [0] http://stackoverflow.com/a/16811930/1623533
>
> Before:
> %PDF-1.5
> %âãÏÓ
>
> After:
> %PDF-1.5
> %����
>
Re: FIS Connectivity usingApache Camel
Posted by Christian Müller <ch...@gmail.com>.
We are using the camel-netty component for a similar requirement (cobal
copybook send to a mainframe system). You have to implement your own
encoder/decoder.
Best,
Christian
-----------------
Software Integration Specialist
Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member
https://www.linkedin.com/pub/christian-mueller/11/551/642
On Thu, Sep 25, 2014 at 7:54 PM, Ravi Gupta 7 <rg...@sapient.com> wrote:
> How we can connect with FIS system using apache camel. FIS system
> understand the request on cobol format?
>
> Thanks & Regards
> Ravi Gupta
>
>
FIS Connectivity usingApache Camel
Posted by Ravi Gupta 7 <rg...@sapient.com>.
How we can connect with FIS system using apache camel. FIS system understand the request on cobol format?
Thanks & Regards
Ravi Gupta