Vert.x HttpClient - how to put parameters to POST ?

3,464 views
Skip to first unread message

Christoph Bittmann

unread,
Sep 24, 2014, 4:34:25 AM9/24/14
to ve...@googlegroups.com

Hi,

I need to put parameters to the POST-Request with HttpClient / HttpClientRequest - but how to do this?

Vert.X Pseudocode:
httpClientRequest = client.post(path, handler);
httpClientRequest.putParameter("Authorization", "foo:foo");

Servlet Code to read the params from the Request:

private List<String> getParams(final org.jboss.resteasy.spi.HttpRequest request) {
final MultivaluedMap<String, String> params = request.getDecodedFormParameters();
.... }

Example in HTML of what I want to do with vert.x:
<form name="token-authorization" action="http://localhost:8080/mobil/rest/dsplogin/login" method=POST>
<input type="hidden" name="Authorization" value="foo:foo"/>
<button type="submit">login</button>
</form>

--> this request look like this:



Tim Fox

unread,
Sep 24, 2014, 4:46:29 AM9/24/14
to ve...@googlegroups.com
There is no such thing in HTTP as "parameters" in a POST request. A POST body is just a blob of data.

I think what you're really asking is how do I create a POST body which is encoded like a form would be when submitted from a browser.

There's an example of that in the test suite (see HttpTest)
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christoph Bittmann

unread,
Sep 24, 2014, 8:21:50 AM9/24/14
to ve...@googlegroups.com
Thanks for your answer. 


On Wednesday, 24 September 2014 10:46:29 UTC+2, Tim Fox wrote:
There is no such thing in HTTP as "parameters" in a POST request. A POST body is just a blob of data.

I think what you're really asking is how do I create a POST body which is encoded like a form would be when submitted from a browser.

I agree, this is what I asking for :)
 

There's an example of that in the test suite (see HttpTest)

Could you please post the peace of source code that do this? I didn't found this in the Test :(

Thank you!

Alexander Lehmann

unread,
Sep 24, 2014, 1:08:01 PM9/24/14
to ve...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages