首页 > 其他分享 >Vert.x response has already been written

Vert.x response has already been written

时间:2023-03-10 10:22:06浏览次数:46  
标签:do already Vert been written response

 

Vert.x response has already been written

https://stackoverflow.com/questions/59935129/vert-x-response-has-already-been-written

 

I am facing a problem with vert.x. When the timeout is triggered it generates a response, then the actual response (takes 10 sec) comes and tries to do the response, so I get a:

java.lang.IllegalStateException: Response has already been written

I am new with Vert.x and I am not sure about the desired behaviour, How should I do it?, since the code is asynchronous I don't find the way to check whether the response has been already sent.

Is there any way to do it porperly?

 

3  

I found out this method, apparently it works:

if (!req.response().ended()) {
    req.response().end(response.body());
}

标签:do,already,Vert,been,written,response
From: https://www.cnblogs.com/lbzwd/p/17202492.html

相关文章