BasicHttpEntity context = new BasicHttpEntity();
context.setContent(new ReaderInputStream(new StringReader("[{status:Hello word from fanfou api!}]"), "utf-8"));
HttpPost post = new HttpPost("/statuses/update.json");
post.setEntity(context);
HttpResponse response = httpclient.execute(targetHost, post, localcontext);
使用的HttpClient4.1.1,从response中得到内容:
<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx</center>
</body>
</html>
Original issue reported on code.google.com by
OutOfClo...@gmail.comon 12 Jun 2011 at 3:26