Hi Grant,

The PostMethod contains support for setting form parameters. Please take a look at PostMethod.addParameter(), PostMethod.setParameter() and <http://jakarta.apache.org/commons/httpclient/methods/post.html>. When using these parameters you will want to set the content type to "application/x-www-form-urlencoded; charset=UTF-8".

Mike

On Jul 6, 2004, at 4:52 PM, Grant Ingersoll wrote:

Hi,

Have searched the archives, but cannot find an answer on how to submit a POST that has form parameters that need to be encoded in UTF-8. I am setting the Content-Type request header, but am unsure as how to set the request body. Do I use a ByteArrayInputStream? Does anyone have an example of how to do this as far as putting FORM parameters into the IS? Do I do something like:

byte [] bytes = "myKey=myValue".getBytes("UTF-8");

ByteArrayInputStream is = new ByteArrayInputStream(bytes);
postMethod.setRequestBody(is);


---
I have 4 such parameters that need to be sent. Any help is appreciated.


Thanks,
Grant


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to