You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2009/07/07 05:50:07 UTC

[jira] Created: (CAMEL-1806) put the query parameters into the message header

put the query parameters into the message header
------------------------------------------------

                 Key: CAMEL-1806
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-http
            Reporter: Willem Jiang
            Assignee: Willem Jiang
             Fix For: 1.6.2, 2.0.0


We will have the query parameter with POST and GET method.
But current Camel just support to put these parameters into the message header with the http GET method.

Here is the user requirement of this[1], we should add this support in Camel.

[1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52785#action_52785 ] 

Claus Ibsen commented on CAMEL-1806:
------------------------------------

@Willem

1)
I think you should revert this change. POST does not support request parameters.
And since the = sign is in the payload you think its a parameter

Parameter name: <?xml version
Value: the rest of the POST body.

2)
And then you should if POST check the URI string instead and only grab the parameters from there.
There must be a method on HttpRequest that can return the URI used. 

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CAMEL-1806) put the query parameters into the message header

Posted by "Jeremy Norris (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59078#action_59078 ] 

Jeremy Norris edited comment on CAMEL-1806 at 4/25/10 12:35 AM:
----------------------------------------------------------------

In order to preserve the message body during "application/x-www-form-urlencoded" POSTs (for the purpose of proxying http endpoints), I've come up the following solution:  This still propagates the form params to the message headers, but the body is preserved.  Feedback is appreciated.  Thanks.

      was (Author: jnorris):
    In order to preserve the message body during "application/x-www-form-urlencoded" POSTs (for the purpose of proxying http endpoints), I've come up the following solution:  This still propagates the form params to the message headers, but the body is preserved.  Feedback is appreciated.  Thanks.

public class HttpBindingPreservePostFormUrlEncodedBody extends DefaultHttpBinding {

    private static final Logger LOG = Logger.getLogger(HttpBindingPreservePostFormUrlEncodedBody.class.getName());
    
    public HttpBindingPreservePostFormUrlEncodedBody() {
    }
    
    public HttpBindingPreservePostFormUrlEncodedBody(HeaderFilterStrategy headerFilterStrategy) {
        super(headerFilterStrategy);
    }

    @Override
    public void readRequest(HttpServletRequest request, HttpMessage message) {    

        // Read body first because DefaultHttpBinding delegate will look for
        // POST MediaType.APPLICATION_FORM_URLENCODED form params and remove
        // them from the body. It will then be our responsibility to add these
        // form params into the message headers to retain compatibility with
        // DefaultHttpBinding.        
        InputStream inputStream = (InputStream) message.getBody();
        String body = "";
        try {
            body = IOUtils.toString(inputStream, "UTF-8");
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
        
        super.readRequest(request, message);

        message.setBody(body);
        
        String contentType = request.getContentType();
        if (contentType != null && contentType.equals(MediaType.APPLICATION_FORM_URLENCODED)) {
            // Push POST form params into the headers to retain compatibility with DefaultHttpBinding
            try {
                for (String param : body.split("&")) {
                    String[] pair = param.split("=", 2);
                    String key = URLDecoder.decode(pair[0], "UTF-8");
                    String value = URLDecoder.decode(pair[1], "UTF-8");
                    message.getHeaders().put(key, value);
                }
            }
            catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }
    }
    
}

And a unit test:

public class TestHttpBindingPreservePostFormUrlEncodedBody extends CamelTestSupport {

    private static final String TEST_POST_BODY = "b1=x&b2=y";
    
    @Test
    public void testSendPost() throws Exception {

        // The test will include POST params and query string params on the same
        // test to ensure everything ends up in the headers.
        
        // It will also ensure that the POST body is preserved when they are
        // form params.
        
        Client client = Client.create();
        WebResource webResource = client.resource("http://localhost:9080/test?q1=x&q2=y");
        
        WebResource.Builder requestBuilder = webResource.getRequestBuilder();
        requestBuilder.type(MediaType.APPLICATION_FORM_URLENCODED);
        
        requestBuilder.post(String.class, TEST_POST_BODY);
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("jetty://http://localhost:9080/test?httpBindingRef=httpBindingPreservePostFormUrlEncodedBody").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        Message in = exchange.getIn();
                        
                        Assert.assertEquals("x", in.getHeader("q1"));
                        Assert.assertEquals("y", in.getHeader("q2"));
                        Assert.assertEquals("x", in.getHeader("b1"));
                        Assert.assertEquals("y", in.getHeader("b2"));   
                        Assert.assertEquals(TEST_POST_BODY, in.getBody(String.class));
                    }
                });
            }
        };
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();
        jndi.bind("httpBindingPreservePostFormUrlEncodedBody", new HttpBindingPreservePostFormUrlEncodedBody());
        return jndi;
    }

}

  
> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (CAMEL-1806) put the query parameters into the message header

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reopened CAMEL-1806:
--------------------------------


And add an unit test based sending a XML body in the POST

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59096#action_59096 ] 

Willem Jiang commented on CAMEL-1806:
-------------------------------------

I did some refactoring on current DefaultHttpBinding[1], now you can override the populateMessageHeader in your HttpBinding to avoid putting the form parameter into message header.

[1] https://issues.apache.org/activemq/browse/CAMEL-2673 

Willem

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>         Attachments: HttpBindingPreservePostFormUrlEncodedBody.java, TestHttpBindingPreservePostFormUrlEncodedBody.java
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "swen vogel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52783#action_52783 ] 

swen vogel commented on CAMEL-1806:
-----------------------------------

I have tested the feature with apache-camel-2.0-SNAPSHOT.zip (Thu Jul 09 17:35:12 GMT+00:00 2009)
and send a very simple XML file as request body:

<?xml version="1.0" encoding="ISO-8859-1"?>
<test>
	Hello World
</test>

And i encountered two problems:

1. In the IN message exists the following curious header:

HEADER NAME:
<?xml version 

HEADER VALUE:
"1.0" encoding="ISO-8859-1"?>
<test>
	Hello World
</test>

2. The original message body of the IN message is empty when processed by following processor's,
     perhaps the stream cache is not reseted?

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Jeremy Norris (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59076#action_59076 ] 

Jeremy Norris commented on CAMEL-1806:
--------------------------------------

@Willem If you are proxying POSTs of type "application/x-www-form-urlencoded", you don't have a choice to use ascii or binary content type, it's part of someone else's API.

I posted some questions about this here: http://old.nabble.com/jetty%3Ahttp-component-%22mangles%22-x-www-form-urlencoded-POST-in-message%3A-td28348176s22882.html

Am I missing something?  Thanks.

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Jeremy Norris (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59078#action_59078 ] 

Jeremy Norris commented on CAMEL-1806:
--------------------------------------

In order to preserve the message body during "application/x-www-form-urlencoded" POSTs (for the purpose of proxying http endpoints), I've come up the following solution:  This still propagates the form params to the message headers, but the body is preserved.  Feedback is appreciated.  Thanks.

public class HttpBindingPreservePostFormUrlEncodedBody extends DefaultHttpBinding {

    private static final Logger LOG = Logger.getLogger(HttpBindingPreservePostFormUrlEncodedBody.class.getName());
    
    public HttpBindingPreservePostFormUrlEncodedBody() {
    }
    
    public HttpBindingPreservePostFormUrlEncodedBody(HeaderFilterStrategy headerFilterStrategy) {
        super(headerFilterStrategy);
    }

    @Override
    public void readRequest(HttpServletRequest request, HttpMessage message) {    

        // Read body first because DefaultHttpBinding delegate will look for
        // POST MediaType.APPLICATION_FORM_URLENCODED form params and remove
        // them from the body. It will then be our responsibility to add these
        // form params into the message headers to retain compatibility with
        // DefaultHttpBinding.        
        InputStream inputStream = (InputStream) message.getBody();
        String body = "";
        try {
            body = IOUtils.toString(inputStream, "UTF-8");
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
        
        super.readRequest(request, message);

        message.setBody(body);
        
        String contentType = request.getContentType();
        if (contentType != null && contentType.equals(MediaType.APPLICATION_FORM_URLENCODED)) {
            // Push POST form params into the headers to retain compatibility with DefaultHttpBinding
            try {
                for (String param : body.split("&")) {
                    String[] pair = param.split("=", 2);
                    String key = URLDecoder.decode(pair[0], "UTF-8");
                    String value = URLDecoder.decode(pair[1], "UTF-8");
                    message.getHeaders().put(key, value);
                }
            }
            catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }
    }
    
}

And a unit test:

public class TestHttpBindingPreservePostFormUrlEncodedBody extends CamelTestSupport {

    private static final String TEST_POST_BODY = "b1=x&b2=y";
    
    @Test
    public void testSendPost() throws Exception {

        // The test will include POST params and query string params on the same
        // test to ensure everything ends up in the headers.
        
        // It will also ensure that the POST body is preserved when they are
        // form params.
        
        Client client = Client.create();
        WebResource webResource = client.resource("http://localhost:9080/test?q1=x&q2=y");
        
        WebResource.Builder requestBuilder = webResource.getRequestBuilder();
        requestBuilder.type(MediaType.APPLICATION_FORM_URLENCODED);
        
        requestBuilder.post(String.class, TEST_POST_BODY);
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("jetty://http://localhost:9080/test?httpBindingRef=httpBindingPreservePostFormUrlEncodedBody").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        Message in = exchange.getIn();
                        
                        Assert.assertEquals("x", in.getHeader("q1"));
                        Assert.assertEquals("y", in.getHeader("q2"));
                        Assert.assertEquals("x", in.getHeader("b1"));
                        Assert.assertEquals("y", in.getHeader("b2"));   
                        Assert.assertEquals(TEST_POST_BODY, in.getBody(String.class));
                    }
                });
            }
        };
    }

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();
        jndi.bind("httpBindingPreservePostFormUrlEncodedBody", new HttpBindingPreservePostFormUrlEncodedBody());
        return jndi;
    }

}


> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1806) put the query parameters into the message header

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-1806.
---------------------------------

    Resolution: Fixed

A better solution
trunk
http://svn.apache.org/viewvc?rev=792899&view=rev
camel 1.x
http://svn.apache.org/viewvc?rev=792957&view=rev

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1806) put the query parameters into the message header

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-1806.
---------------------------------

    Resolution: Fixed

trunk
http://svn.apache.org/viewvc?rev=791695&view=rev
camel-1.x branch
http://svn.apache.org/viewvc?rev=791698&view=rev

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52790#action_52790 ] 

Willem Jiang commented on CAMEL-1806:
-------------------------------------

@Claus
HTTP supports to sent the queries parameters through GET method's URI, 
since there is a length limitation of URI,  it supports to use POST method to sent the queries parameters.
As Sergey said, if the content-type is "application/x-www-form-urlencoded" we need to take the parameter from the POST input stream.

I will add a xml unit test and content type verification. 

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52789#action_52789 ] 

Sergey Beryozkin commented on CAMEL-1806:
-----------------------------------------

> POST does not support request parameters.

URIs used in POST requests may still contain queries - it may not be regarded as the best use of queries but it may be used. For ex, JAX-RS spec does not prohibit having resource methods like :

@POST
void doPost(@QueryParam("a")  String s) {}

Another variation is form submissions, with application/x-www-form-urlencoded. Even though name-value pairs go in the request body, the names can still be accessed as Form parameters. In fact, the WADL spec types such parameters as 'query'

Sergey

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1806) put the query parameters into the message header

Posted by "Jeremy Norris (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Norris updated CAMEL-1806:
---------------------------------

    Attachment: HttpBindingPreservePostFormUrlEncodedBody.java
                TestHttpBindingPreservePostFormUrlEncodedBody.java

In order to preserve the message body during "application/x-www-form-urlencoded" POSTs (for the purpose of proxying http endpoints), I've come up the following solution: This still propagates the form params to the message headers, but the body is preserved. Feedback is appreciated. Thanks.

(Attached is HttpBinding implementation and an associated unit test).

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>         Attachments: HttpBindingPreservePostFormUrlEncodedBody.java, TestHttpBindingPreservePostFormUrlEncodedBody.java
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=53629#action_53629 ] 

Claus Ibsen commented on CAMEL-1806:
------------------------------------

Willem there is still issues with this. When you POST data using x-www-form-urlencoded such as a ascii/binary file you want the content of this to be stored in the message body and not as HTTP headers.

For example
{code}
 curl -d@src/test/data/data.txt http://localhost:9080/myapp/myservice
{code}

Where we want to post the data.txt file to Camel and want its content to be in the body

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57027#action_57027 ] 

Willem Jiang commented on CAMEL-1806:
-------------------------------------

@Claus
If you post the data with ascii or binary the content-type will not be set with "application/x-www-form-urlencoded".
So current solution is safe for your case.

BTW, 
When a web browser sends a POST request from an HTML form element, the Internet media type is "application/x-www-form-urlencoded".

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1806) put the query parameters into the message header

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59080#action_59080 ] 

Willem Jiang commented on CAMEL-1806:
-------------------------------------

Hi Jeremy
I went through your HttpBindingPreservePostFormUrlEncodedBody.java and found something.
You need to use the request.getCharacterEncoding() to check the message body instead of using "UTF-8"  directly.

I just broke the readRequst() Method of DefaultHttpBinding into some smaller methods, you can choice if you want populate the message headers from the request parameters.

> put the query parameters into the message header
> ------------------------------------------------
>
>                 Key: CAMEL-1806
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1806
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-http
>            Reporter: Willem Jiang
>            Assignee: Willem Jiang
>             Fix For: 1.6.2, 2.0.0
>
>         Attachments: HttpBindingPreservePostFormUrlEncodedBody.java, TestHttpBindingPreservePostFormUrlEncodedBody.java
>
>
> We will have the query parameter with POST and GET method.
> But current Camel just support to put these parameters into the message header with the http GET method.
> Here is the user requirement of this[1], we should add this support in Camel.
> [1] http://www.nabble.com/Jetty-component-and-HTTP-parameter-to24287116.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.