简体   繁体   English

IOException并发超时inputStream读取HTTP请求

[英]IOException Concurrent timeout inputStream read HTTP request

Using vertx-web-client to make a POST call to a web service deployed in glassfish I was getting IOException 使用vertx-web-client对在glassfish中部署的Web服务进行POST调用我得到IOException

java.util.concurrent.TimeoutException
at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read(TemporarySelectorReader.java:126)
at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read(TemporarySelectorReader.java:75)

But using Postman with the same body everything worked fine. 但是,将Postman与相同的身体一起使用,一切正常。

What was happening was that the web-client was using chunked transfer encoding(chunk streaming). 发生的事情是,Web客户端正在使用分块传输编码(分块流)。
according to vert.x Documentation 根据vert.x文档

When you know the size of the stream, you shall specify before using the content-length header ... .putHeader("content-length", fileLen) 当您知道流的大小时,应在使用content-length标头... .putHeader("content-length", fileLen)

and thus 因此

The POST will not be chunked. POST将不会被分块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM