Scenario :
- Web application connecting to a java servlet. (Using embedded jetty)
- High latency request, example a report generation ( takes seconds)
- User can close the browser in between the http request response cycle.
Problem :
How to detect browser closed in between the request and response cycle, at the server side ?
Though the problem can be solved by using another request from the UI, I was wondering whether we could get the information from the communication protocol itself ? As HTTP is using TCP/IP as the base protocol, shouldn't we be able to detect this as a connection closed from the connection initiator side.
I went through the servlet apis and also the api used for configuring jetty server but couldn't find anything closely related.
Also went through these stackoverflow questions
- Java Servlet : How to detect browser closing?
- How to detect browser close at server side in asp.net?
Any insights ?