hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre John Mas <aj...@newtradetech.com>
Subject Order of methods in PostMethod
Date Thu, 10 Apr 2003 21:23:22 GMT
I have just spent the best part of two days trying to work out why
a servlet running int Tomcat was not getting UTF-8 when I had set my
client to send UTF-8. It turns out that if I set my PostMethod request
header after setting the request body the content does not get sent as
UTF-8.

The following gets sent as UTF-8:

       PostMethod post = new PostMethod(destinationUrl.toString());
       post.setStrictMode(false);
       post.setRequestHeader("Content-Type","text/xml; charset=UTF-8");
       post.setRequestHeader("user-agent", "myAgent");
       post.setRequestBody(content);
       post.setFollowRedirects(true);

the following doesn't:

       PostMethod post = new PostMethod(destinationUrl.toString());
       post.setStrictMode(false);
       post.setRequestBody(content);
       post.setRequestHeader("Content-Type","text/xml; charset=UTF-8");
       post.setRequestHeader("user-agent", "myAgent");
       post.setFollowRedirects(true);

reading the following web page gives no indication of this:

   http://jakarta.apache.org/commons/httpclient/charencodings.html

Is this a bug or something that is not clear in the docs.

Andre



Mime
View raw message