Content has been consumed

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Content has been consumed相关的知识,希望对你有一定的参考价值。

  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的主要内容,如果未能解决你的问题,请参考以下文章

Https异常This request has been blocked; the content must be served over HTTPS

在普通网页显示正常,加Https报This request has been blocked; the content must be served over HTTPS.,https网站加载http

歌词the time has been changed

USING CURRENT LOGFILE has been deprecated

this license has been cancelled

has been blocked by CORS policy