Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java's HttpServletResponse doesn't have isClientConnected method

840598Sep 30 2011 — edited Oct 10 2011
I'm implementing a long poll http connection using java servlet.

How can I know that the http client is still active at any instance? Currently, what I do is to write a byte to the output stream and flush data. If there's an IO exception then the client is dead.

But in ASP.NET there is a property, Response.IsClientConnected which can find out if the client is active without writing anything to the output stream.

I want to know how if it is possible to develop in java servlet. I do not want to keep writing data into the http response stream as it may cost network.

Thanks in advance.
This post has been answered by 802889 on Oct 4 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2011
Added on Sep 30 2011
28 comments
1,701 views