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.
}
精彩评论