camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: CXF http-conduit AllowChunking does not work
Date Wed, 10 Nov 2010 13:55:43 GMT
The patch is here[1]

You can verify the patch by using the latest Camel 2.6-SNAPSHOT, if you 
are still using Camel 2.5.0, you can write a customer 
CXFHeaderFilterStrategy based on my patch, and configure it into you 
CXFEndpoint.

[1]http://svn.apache.org/viewvc?rev=1032983&view=rev



On 11/10/10 7:16 PM, unmarshall wrote:
>
>
> Hi Willem,
>
> What is the quick fix that you have made?
> It was not clear of whether you used HttpHeaderFilterStrategy or
> CxfHeaderFilterStrategy?
>
> And yes the default threshold of 4K set by CXF is fine by me and i
> understood the reason for it being set when i saw that. However my concern
> was that once the payload is below that threshold then CXF should not
> blindly turn off chunking and not bother about removing the header. This
> will cause the request to fail at the servlet container side.
>
> Best Regards,
> Madhav
>
>
> Willem.Jiang wrote:
>>
>>>
>>> Yes, I just checked the code, even the AllowChunking default value is
>>> ture, because of the ChunkingThreshold is 4096. CXF HttpConduit will not
>>> check the request.
>>>
>>> The problem is surely in CXF but i was hoping that the CXF-Camel
>>> component
>>> can re-use HttpHeaderFilterStrategy to filter out common headers.
>>
>>> Yes, I just commit a quick fix for it from camel-cxf side by applying
>>> the same header filter strategy of Http.
>>> camel-cxf should filter the Generic Message header[1] by default
>>> [1]http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
>>>
>>> This solution looks more like a hack. Ideally CXF should take care of
>>> checking for certain headers and then club it together with its logic for
>>> automatically enabling chunking beyond a certain threshold.
>>>
>> After my second thought, I think we just need to fix your issue from
>> camel side, CXF HttpConduit should to take care about the
>> "transfer-encoding" as it just need to care about point to point
>> transport.
>>
>> CXF choices the 4K as the ChunkingThreshold is to get better
>> performance. I think this is OK for me.
>>
>>>
>>> Best Regards,
>>> Madhav
>>>
>>>
>>>
>>>
>>>
>>> Willem.Jiang wrote:
>>>>
>>>> Hi Madhav,
>>>>
>>>> Can I have a look at your route?
>>>> I think the Transfer-Encoding = chunked value can be filtered by a
>>>> customer CxfHeaderFilterStrategy.
>>>>
>>>> How about just add this configuration ?
>>>> <http-conf:conduit name="*.http-conduit">
>>>> 	<http-conf:client AllowChunking="true"/>
>>>> </http-conf:conduit>
>>>>
>>>> Now I need to check the CXF code to see if I can let the http conduit
>>>> just send the chucked request if the protocol header is
>>>> "Transfer-Encoding = chunked".
>>>>
>>>> On 11/4/10 12:33 AM, unmarshall wrote:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I got this working. The problem is that CXF is not smart enough to
>>>>> determine
>>>>> that there is a Transfer-Encoding = chunked being set by the server (in
>>>>> my
>>>>> case it was tomcat). It defines a threshold value below which it will
>>>>> not
>>>>> chunk the body and only if the the size is above the threshold it will
>>>>> chunk
>>>>> it.
>>>>>
>>>>> The problem is that when it decides not to chunk it does not chunk the
>>>>> payload but the it does not remove the header. So when the request goes
>>>>> to
>>>>> the server it sees that the chunked transfer-encoding has been set but
>>>>> the
>>>>> CXF did not chunk the request. So the server throws an exception saying
>>>>> its
>>>>> an invalid chunk header.
>>>>>
>>>>> In Camel HTTP component this has been taken care by having a
>>>>> HttpHeaderFilterStrategy and therefore this does not happen if camel
>>>>> http
>>>>> endpoints are used instead of CXF.
>>>>>
>>>>> This in my opinion is a BUG.
>>>>>
>>>>> The workaround is that the threshold should be set to a very low value
>>>>> so
>>>>> it
>>>>> chunks almost all requests.
>>>>>
>>>>> Best Regards,
>>>>> Madhav
>>>>>
>>>>>
>>>>> unmarshall wrote:
>>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I am using Camel 2.5. I need to disable chunking and for that i have
>>>>>> configured the following:
>>>>>>
>>>>>> <http-conf:conduit name="*.http-conduit">
>>>>>> 		<http-conf:client AllowChunking="false"/>
>>>>>> </http-conf:conduit>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Willem
>>>> ----------------------------------
>>>> FuseSource
>>>> Web: http://www.fusesource.com
>>>> Blog:    http://willemjiang.blogspot.com (English)
>>>>             http://jnn.javaeye.com (Chinese)
>>>> Twitter: willemjiang
>>>>
>>>>
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> FuseSource
>> Web: http://www.fusesource.com
>> Blog:    http://willemjiang.blogspot.com (English)
>>            http://jnn.javaeye.com (Chinese)
>> Twitter: willemjiang
>>
>>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Mime
View raw message