Since RAP 2.1. the client sends a notification to the server to shut the session down:
{"head":{"rwt_shutdown":true,"requestCounter":7},"operations":[]}
This is a very nice feature, but in our case we would also need to know if the session was terminated this way:
When our users open for example a person record and edit it but do not save, then close the application via the x-button, our Workbench-pre shutdown listener fires and closes all open windows. If unsaved changes are present it displays a message if the users wants to save or discard, after that the person gets unlocked in the database. The users chooses and then the normal shutdown-procedure continues.
But when the user just closes the browser the pre-shutdown listener also fire and the message is displayed, but the client is not connected any more. So the thread waits and waits.
If we could determine that the browser was closed we could discard the changes automatically and unlock the person in the database.
We looked at the RAP-source code but did not find any reference to the last received message, also RWT.getRequest.getInputStream() does not work in this case.
Is there any way to do this?