hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Irmen de Jong <ir...@xs4all.nl>
Subject method.setRequestBody suggestion/question: byte[] ?
Date Wed, 18 Jun 2003 09:43:18 GMT
Hi
I've got a suggestion (or a question) about the setRequestBody on the Method
objects. (using HTTP Client 2.0 beta)

There are three versions:
one that takes a String, one that takes an InputStream, and one that
takes a NameValuePair[].

Why isn't there a setRequestBody that takes a byte[] ?

I need this because I have this XML document encoded using UTF-8 in a byte[],
and I want to add this as the request body in a PostMethod.

Currently I've solved this by using the InputStream version:
method.setRequestHeader("Content-type", "text/xml; charset=UTF-8");
method.setRequestBody(new java.io.ByteArrayInputStream(xmlDocument));

I can't use the String version of setRequestBody because I don't know
how that one encodes the String in the message (that isn't documented?).

Thanks in advance for any comments/suggestions on this.

--Irmen de Jong

PS I'm not on the mailing list, so please reply privately too...


Mime
View raw message