You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gasius <na...@combalt.com> on 2012/08/31 16:01:25 UTC

Jetty component cuts response

Hi,

I created some proxy application using Jetty component (on ServiceMix
v4.4.2, Camel version 2.8.5) and the problem is that larger responses are
cut to 7601 bytes. For example my Camel route looks like this:

from
/jetty:http://0.0.0.0:9080/MyApplication/MyService?bridgeEndpoint=true&disableStreamCache=true&throwExceptionOnFailure=false&chunked=false&enableMultipartFilter=false/
to
/jetty:http://127.0.0.1:9083/MyRealApplication/MyService?bridgeEndpoint=true&disableStreamCache=true&throwExceptionOnFailure=false/

Everything works as expected while response from MyRealApplication is under
7601 otherwise I receive only partial response. I tried to add httpBinding
which prints header information of the response. Below are headers of 7657
bytes response (I took Exchange object in writeResponse method of
HttpBinding):

/Header CamelHttpCharacterEncoding: UTF-8
Header Content-Length: 7657
Header CamelHttpUri: /MyApplication/MyService
Header CamelHttpServletResponse: HTTP/1.1 200
Content-Type: text/xml;charset=UTF-8
Server: Jetty(6.1.22)
SOAPAction: "http://MyApplication/MyService/getDelegationList"
User-Agent: Jakarta Commons-HttpClient/3.1
Accept-Encoding: gzip,deflate
Host: myhost:9080
Content-Length: 7601


Header CamelHttpServletRequest: [POST MyApplication/MyService]@29566127
org.eclipse.jetty.server.Request@1c324af
Header CamelHttpResponseCode: 200
Header Host: myhost:9080
Header Server: Jetty(6.1.22)
Header SOAPAction: "http://MyApplication/MyService/getDelegationList"
Header CamelHttpUrl: http://myhost:9080/MyApplication/MyService
Header Accept-Encoding: gzip,deflate
Header CamelHttpMethod: POST
Header CamelHttpPath: /MyApplication/MyService
Header Content-Type: text/xml; charset=utf-8
Header CamelHttpQuery: null
Header User-Agent: Jakarta Commons-HttpClient/3.1/

So according headers information I see that component received full response
(Content-Length: 7657) but CamelHttpServletResponse contains only 7601 bytes
(Content-Length: 7601). What am I doing wrong? 



--
View this message in context: http://camel.465427.n5.nabble.com/Jetty-component-cuts-response-tp5718473.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Jetty component cuts response

Posted by gasius <na...@combalt.com>.
Thank you for responses. 

So I found that Camel sometimes sets incorrect Content-Length header value
when getting content as String in
org.apache.camel.component.http.DefaultHttpBinding. It is fixed only in
version 2.10.x. For earlier versions the possible way to fix this is to use
custom HttpBinding overriding method writeResponse and fixing it there.



--
View this message in context: http://camel.465427.n5.nabble.com/Jetty-component-cuts-response-tp5718473p5718545.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Jetty component cuts response

Posted by Karolis Petrauskas <k....@gmail.com>.
Hi,

    Have you tried to disable the chunking? It should be configurable
via conduit of the "real" application.

Best regards,
Karolis

On Fri, Aug 31, 2012 at 5:42 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> There were some issues with that chunked true|false and some of the
> http components, cutting data in binary or ascii mode.
> There is possible some JIRA tickets you can find about this.
>
> And if possible try outside SMX with a pure Camel app, and then try
> with the latest 2.9, or 2.10 release to see if its fixed for you.
>
>
> On Fri, Aug 31, 2012 at 4:01 PM, gasius <na...@combalt.com> wrote:
>> Hi,
>>
>> I created some proxy application using Jetty component (on ServiceMix
>> v4.4.2, Camel version 2.8.5) and the problem is that larger responses are
>> cut to 7601 bytes. For example my Camel route looks like this:
>>
>> from
>> /jetty:http://0.0.0.0:9080/MyApplication/MyService?bridgeEndpoint=true&disableStreamCache=true&throwExceptionOnFailure=false&chunked=false&enableMultipartFilter=false/
>> to
>> /jetty:http://127.0.0.1:9083/MyRealApplication/MyService?bridgeEndpoint=true&disableStreamCache=true&throwExceptionOnFailure=false/
>>
>> Everything works as expected while response from MyRealApplication is under
>> 7601 otherwise I receive only partial response. I tried to add httpBinding
>> which prints header information of the response. Below are headers of 7657
>> bytes response (I took Exchange object in writeResponse method of
>> HttpBinding):
>>
>> /Header CamelHttpCharacterEncoding: UTF-8
>> Header Content-Length: 7657
>> Header CamelHttpUri: /MyApplication/MyService
>> Header CamelHttpServletResponse: HTTP/1.1 200
>> Content-Type: text/xml;charset=UTF-8
>> Server: Jetty(6.1.22)
>> SOAPAction: "http://MyApplication/MyService/getDelegationList"
>> User-Agent: Jakarta Commons-HttpClient/3.1
>> Accept-Encoding: gzip,deflate
>> Host: myhost:9080
>> Content-Length: 7601
>>
>>
>> Header CamelHttpServletRequest: [POST MyApplication/MyService]@29566127
>> org.eclipse.jetty.server.Request@1c324af
>> Header CamelHttpResponseCode: 200
>> Header Host: myhost:9080
>> Header Server: Jetty(6.1.22)
>> Header SOAPAction: "http://MyApplication/MyService/getDelegationList"
>> Header CamelHttpUrl: http://myhost:9080/MyApplication/MyService
>> Header Accept-Encoding: gzip,deflate
>> Header CamelHttpMethod: POST
>> Header CamelHttpPath: /MyApplication/MyService
>> Header Content-Type: text/xml; charset=utf-8
>> Header CamelHttpQuery: null
>> Header User-Agent: Jakarta Commons-HttpClient/3.1/
>>
>> So according headers information I see that component received full response
>> (Content-Length: 7657) but CamelHttpServletResponse contains only 7601 bytes
>> (Content-Length: 7601). What am I doing wrong?
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Jetty-component-cuts-response-tp5718473.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

Re: Jetty component cuts response

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

There were some issues with that chunked true|false and some of the
http components, cutting data in binary or ascii mode.
There is possible some JIRA tickets you can find about this.

And if possible try outside SMX with a pure Camel app, and then try
with the latest 2.9, or 2.10 release to see if its fixed for you.


On Fri, Aug 31, 2012 at 4:01 PM, gasius <na...@combalt.com> wrote:
> Hi,
>
> I created some proxy application using Jetty component (on ServiceMix
> v4.4.2, Camel version 2.8.5) and the problem is that larger responses are
> cut to 7601 bytes. For example my Camel route looks like this:
>
> from
> /jetty:http://0.0.0.0:9080/MyApplication/MyService?bridgeEndpoint=true&disableStreamCache=true&throwExceptionOnFailure=false&chunked=false&enableMultipartFilter=false/
> to
> /jetty:http://127.0.0.1:9083/MyRealApplication/MyService?bridgeEndpoint=true&disableStreamCache=true&throwExceptionOnFailure=false/
>
> Everything works as expected while response from MyRealApplication is under
> 7601 otherwise I receive only partial response. I tried to add httpBinding
> which prints header information of the response. Below are headers of 7657
> bytes response (I took Exchange object in writeResponse method of
> HttpBinding):
>
> /Header CamelHttpCharacterEncoding: UTF-8
> Header Content-Length: 7657
> Header CamelHttpUri: /MyApplication/MyService
> Header CamelHttpServletResponse: HTTP/1.1 200
> Content-Type: text/xml;charset=UTF-8
> Server: Jetty(6.1.22)
> SOAPAction: "http://MyApplication/MyService/getDelegationList"
> User-Agent: Jakarta Commons-HttpClient/3.1
> Accept-Encoding: gzip,deflate
> Host: myhost:9080
> Content-Length: 7601
>
>
> Header CamelHttpServletRequest: [POST MyApplication/MyService]@29566127
> org.eclipse.jetty.server.Request@1c324af
> Header CamelHttpResponseCode: 200
> Header Host: myhost:9080
> Header Server: Jetty(6.1.22)
> Header SOAPAction: "http://MyApplication/MyService/getDelegationList"
> Header CamelHttpUrl: http://myhost:9080/MyApplication/MyService
> Header Accept-Encoding: gzip,deflate
> Header CamelHttpMethod: POST
> Header CamelHttpPath: /MyApplication/MyService
> Header Content-Type: text/xml; charset=utf-8
> Header CamelHttpQuery: null
> Header User-Agent: Jakarta Commons-HttpClient/3.1/
>
> So according headers information I see that component received full response
> (Content-Length: 7657) but CamelHttpServletResponse contains only 7601 bytes
> (Content-Length: 7601). What am I doing wrong?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Jetty-component-cuts-response-tp5718473.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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