You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Parsa Ghaffari <pa...@gmail.com> on 2011/07/13 13:24:59 UTC

Apache Camel Jetty Component: File upload request always has empty body

Hi folks,

I'm using Akka's Camel module to build an endpoint to handle file uploads.

The arriving request headers when uploading a file using an html form
(withenctype="multipart/form-data") is:

CamelHttpUrl -> http://localhost:8080/add,
Keep-Alive -> 300,
Connection -> keep-alive,
Content-Length -> 568,
MessageExchangeId -> ID-macbook-local-53142-1310548391856-0-8,
Accept -> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
Cache-Control -> max-age=0,
CamelHttpMethod -> POST,
CamelHttpQuery -> null,
Content-Type -> multipart/form-data;
boundary=---------------------------147483316912648177091998097157,
CamelHttpServletRequest ->
org.eclipse.jetty.servlets.MultiPartFilter$Wrapper@4545f5e3,
Accept-Charset -> ISO-8859-1,utf-8;q=0.7,*;q=0.7,
Accept-Language -> en-us,en;q=0.5,
Accept-Encoding -> gzip,deflate,
User-Agent -> Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
rv:1.9.0.19) Gecko/2010031218 Firefox/3.0.19,
Host -> localhost:8080, CamelHttpUri -> /add,
CamelHttpServletResponse -> HTTP/1.1 200
, CamelHttpPath -> /add, file -> test.htm

The request body however is empty. Any suggestions? I'm using Apache
Camel 2.7.1.

Thanks in advance.
Best,
Parsa

Re: Apache Camel Jetty Component: File upload request always has empty body

Posted by Claus Ibsen <cl...@gmail.com>.
Hmmm

You can try to load the message content right after jetty

from jetty
  convertBodyTo(String.class)

This force the content to be loaded into memory as a String.

If you need a byte[] then you can possible do
  convertBodyTo(byte[].class)



On Wed, Jul 13, 2011 at 1:56 PM, Parsa Ghaffari
<pa...@gmail.com> wrote:
> Well I'm calling context.setStreamCache(true); so I believe that's not
> the issue. Thanks anyways.
>
>
> On Wed, Jul 13, 2011 at 3:59 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> Hi
>>
>> On the camel-jetty wiki page there is a notice about stream based
>> http://camel.apache.org/jetty
>>
>> Maybe you hit this issue.
>>
>>
>> On Wed, Jul 13, 2011 at 1:24 PM, Parsa Ghaffari
>> <pa...@gmail.com> wrote:
>>> Hi folks,
>>>
>>> I'm using Akka's Camel module to build an endpoint to handle file uploads.
>>>
>>> The arriving request headers when uploading a file using an html form
>>> (withenctype="multipart/form-data") is:
>>>
>>> CamelHttpUrl -> http://localhost:8080/add,
>>> Keep-Alive -> 300,
>>> Connection -> keep-alive,
>>> Content-Length -> 568,
>>> MessageExchangeId -> ID-macbook-local-53142-1310548391856-0-8,
>>> Accept -> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
>>> Cache-Control -> max-age=0,
>>> CamelHttpMethod -> POST,
>>> CamelHttpQuery -> null,
>>> Content-Type -> multipart/form-data;
>>> boundary=---------------------------147483316912648177091998097157,
>>> CamelHttpServletRequest ->
>>> org.eclipse.jetty.servlets.MultiPartFilter$Wrapper@4545f5e3,
>>> Accept-Charset -> ISO-8859-1,utf-8;q=0.7,*;q=0.7,
>>> Accept-Language -> en-us,en;q=0.5,
>>> Accept-Encoding -> gzip,deflate,
>>> User-Agent -> Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
>>> rv:1.9.0.19) Gecko/2010031218 Firefox/3.0.19,
>>> Host -> localhost:8080, CamelHttpUri -> /add,
>>> CamelHttpServletResponse -> HTTP/1.1 200
>>> , CamelHttpPath -> /add, file -> test.htm
>>>
>>> The request body however is empty. Any suggestions? I'm using Apache
>>> Camel 2.7.1.
>>>
>>> Thanks in advance.
>>> Best,
>>> Parsa
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>
>
>
> --
> Parsa Ghaffari
> Twitter | LinkedIn | AYLIEN
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Apache Camel Jetty Component: File upload request always has empty body

Posted by Parsa Ghaffari <pa...@gmail.com>.
Well I'm calling context.setStreamCache(true); so I believe that's not
the issue. Thanks anyways.


On Wed, Jul 13, 2011 at 3:59 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> On the camel-jetty wiki page there is a notice about stream based
> http://camel.apache.org/jetty
>
> Maybe you hit this issue.
>
>
> On Wed, Jul 13, 2011 at 1:24 PM, Parsa Ghaffari
> <pa...@gmail.com> wrote:
>> Hi folks,
>>
>> I'm using Akka's Camel module to build an endpoint to handle file uploads.
>>
>> The arriving request headers when uploading a file using an html form
>> (withenctype="multipart/form-data") is:
>>
>> CamelHttpUrl -> http://localhost:8080/add,
>> Keep-Alive -> 300,
>> Connection -> keep-alive,
>> Content-Length -> 568,
>> MessageExchangeId -> ID-macbook-local-53142-1310548391856-0-8,
>> Accept -> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
>> Cache-Control -> max-age=0,
>> CamelHttpMethod -> POST,
>> CamelHttpQuery -> null,
>> Content-Type -> multipart/form-data;
>> boundary=---------------------------147483316912648177091998097157,
>> CamelHttpServletRequest ->
>> org.eclipse.jetty.servlets.MultiPartFilter$Wrapper@4545f5e3,
>> Accept-Charset -> ISO-8859-1,utf-8;q=0.7,*;q=0.7,
>> Accept-Language -> en-us,en;q=0.5,
>> Accept-Encoding -> gzip,deflate,
>> User-Agent -> Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
>> rv:1.9.0.19) Gecko/2010031218 Firefox/3.0.19,
>> Host -> localhost:8080, CamelHttpUri -> /add,
>> CamelHttpServletResponse -> HTTP/1.1 200
>> , CamelHttpPath -> /add, file -> test.htm
>>
>> The request body however is empty. Any suggestions? I'm using Apache
>> Camel 2.7.1.
>>
>> Thanks in advance.
>> Best,
>> Parsa
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Parsa Ghaffari
Twitter | LinkedIn | AYLIEN

Re: Apache Camel Jetty Component: File upload request always has empty body

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

On the camel-jetty wiki page there is a notice about stream based
http://camel.apache.org/jetty

Maybe you hit this issue.


On Wed, Jul 13, 2011 at 1:24 PM, Parsa Ghaffari
<pa...@gmail.com> wrote:
> Hi folks,
>
> I'm using Akka's Camel module to build an endpoint to handle file uploads.
>
> The arriving request headers when uploading a file using an html form
> (withenctype="multipart/form-data") is:
>
> CamelHttpUrl -> http://localhost:8080/add,
> Keep-Alive -> 300,
> Connection -> keep-alive,
> Content-Length -> 568,
> MessageExchangeId -> ID-macbook-local-53142-1310548391856-0-8,
> Accept -> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
> Cache-Control -> max-age=0,
> CamelHttpMethod -> POST,
> CamelHttpQuery -> null,
> Content-Type -> multipart/form-data;
> boundary=---------------------------147483316912648177091998097157,
> CamelHttpServletRequest ->
> org.eclipse.jetty.servlets.MultiPartFilter$Wrapper@4545f5e3,
> Accept-Charset -> ISO-8859-1,utf-8;q=0.7,*;q=0.7,
> Accept-Language -> en-us,en;q=0.5,
> Accept-Encoding -> gzip,deflate,
> User-Agent -> Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
> rv:1.9.0.19) Gecko/2010031218 Firefox/3.0.19,
> Host -> localhost:8080, CamelHttpUri -> /add,
> CamelHttpServletResponse -> HTTP/1.1 200
> , CamelHttpPath -> /add, file -> test.htm
>
> The request body however is empty. Any suggestions? I'm using Apache
> Camel 2.7.1.
>
> Thanks in advance.
> Best,
> Parsa
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/