camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: jetty:http component "mangles" x-www-form-urlencoded POST in message:
Date Sat, 24 Apr 2010 07:19:18 GMT
greenstar wrote:
> When a POST arrives to an endpoint:
> ie:
> curl -d "x=1&y=2 http://localhost/foobar
> The IN body is removed and the form params are moved to the message header. 
> How can I disable this feature?

Current camel-jetty component doesn't support to disable this feature by 
doing some simple configuration.

>  When this happens, I cannot "proxy" through
> to another http endpoint that expects a POST of type
> application/x-www-form-urlencoded unless I recreate the body myself. 
> (However, even still, recreating the body would be difficult because it's
> hard to determine which headers where actually form params in the original
> POST body and which were not because they aren't distinguished from the
> other headers in any way).
> This "feature" seems to be described 
> here .  Perhaps I am
> missing something, but is this feature really a good idea?  When the request
> is mangled in this way, I cannot pass this message through to another
> service (proxy) because the body of the message is gone.  I can perhaps see
> pushing the form params into the headers while leaving the body intact, but
> what is the rationale for removing the body?
When you call the HttpServletRequest.getParameterNames(), it will 
consumer the body part if the content-type is 

> If this feature was removed, one could always write a filter to convert POST
> bodies to headers for type application/x-www-form-urlencoded.  However, with
> this feature implemented the way it is, it makes proxying POSTs of type
> application/x-www-form-urlencoded practically impossible.  Am I missing
> something?

Using a filter could a way to do it, it will introduce other problem.
Because When we create the CamelServlet, we don't know if the endpoint 
will be used as a proxy or not, it should be better to do it in 

Here is a way for you to work around this issue by extending the 
DefaultHttpBinding without calling the 
HttpServletRequest.getParameterNames() if the method is POST , then you 
set this binding into the JettyHttpComponent.
> Thanks for your help.
> (I am using Camel 2.2.0).


View raw message