hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Manzoni <manzoni.alessand...@gmail.com>
Subject 400 bad request POSTing to Tomcat 7.0.42
Date Wed, 25 Feb 2015 16:26:17 GMT
I made a simple client that sends a xml stream to a webapp running on 
tomcat 7 by POST method.
Both client and tomcat run on the same server (linux). HTTPClient 
version is 4.2.2.

The xml stream is formally correct. Somtimes, when the stream is more 
than 30KB tomcat replies with an html page reporting 400 bad request. 
When the stream is smaller goes fine.

This is my code:
             HttpClient httpclient = new DefaultHttpClient();
             HttpPost httppost = new HttpPost(uri);
             StringEntity entity = new StringEntity(new 
String(output.toByteArray()), ContentType.TEXT_XML);
             httppost.setEntity(entity);
             return httpclient.execute(httppost);

where:
- uri is the uri of the webapp, always the same.
- output is a ByteArrayOutputStream that contains the xml stream

Should I put some more headers? Or change somewhat to avoid the error?

Thanks, regards.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message