码迷,mamicode.com
首页 > 其他好文 > 详细

Content has been consumed

时间:2016-04-03 23:59:57      阅读:418      评论:0      收藏:0      [点我收藏+]

标签:

  1. if(response.getEntity() != null && response.getEntity().getContent() != null)  
  2. {  
  3.                 message = IOUtils.toString(response.getEntity().getContent());  
  4. }
会报Content has been consumed错误

这个问题是多次调用HttpEntity.getContent()导致的, Entity中的内容只能读取一次, 参考如下:


You can retrieve the content from the entity only once. If you have 
already extracted the content somewhere, and you try to fetch it 
again, it will throw this IllegalStateException. Check you code and 
make sure that you make this call only once.


看一下:http://blog.csdn.net/boonya/article/details/42740235






Content has been consumed

标签:

原文地址:http://www.cnblogs.com/zshengfei/p/5351042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!