- if(response.getEntity() != null && response.getEntity().getContent() != null)
- {
- message = IOUtils.toString(response.getEntity().getContent());
- }
会报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
来源: http://www.linuxidc.com/Linux/2011-08/40654.htm
时间: 2024-11-13 07:37:34