开发者

verify connection in jersey

开发者 https://www.devze.com 2023-02-01 10:07 出处:网络
I want to be able to verify that the connection is still alive (client not dead) when sending a response from a Jersey (jax-rs) resource. The reason is that if I just return the response object and th

I want to be able to verify that the connection is still alive (client not dead) when sending a response from a Jersey (jax-rs) resource. The reason is that if I just return the response object and the client is dead, the response is lost witho开发者_如何转开发ut knowing that the client did not receive it.


httpContext.getResponse().setResponse(myResponse)
try {
  httpContext.getResponse().getOutputStream().write(new byte[]{})
} catch (Exception e) {
  // writing of headers failed. 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消