问题一:
1. java.lang.IllegalStateExceptio n: 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.
2. http header 中的content-length
这个问题导致了各种千奇百怪的error,反正就无法返回数据。
比如; source not found, Runtime Exception等等问题,其实问题出现在测试服务器上的Nignx的返回头部没有包含Content-length这项信息,所用通过代码
int length = ( int ) httpEntity.getContentLength()