You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Gerardo Corro <ro...@hotmail.com> on 2009/07/19 01:00:30 UTC

postMethod.setRequestEntity encoding issues

Hi HC people,


I'm implementing a filter that processes POST requests, these requests have query parameters that were encoded with UTF-8, if I try something like:

if (httpRequest.getMethod().equals("POST")) {
   ((PostMethod) httpMethod).setRequestEntity(new InputStreamRequestEntity(request.getInputStream(),
   request.getContentLength(),
   request.getContentType()));
}

The query parameters are not received correctly on the other side, however if I change the 'method' of the form to 'get' and then I do something like:

httpMethod.setURI(new URI(resourcePath.toString(), true, "UTF--8"));

then everything works properly, so the problem is that if the request comes as a 'POST' its encoding is not being processed properly.

Please assist. Thanks!



_________________________________________________________________
Share your memories online with anyone you want.
http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1