This topic has been dicussed a few times, at great length, here and in the
JSP forum. In every case, I've maintained that there isn't a reliable way to do this in a webapp. I've yet to see an argument that will change my mind.
I'm not sure how easy it will be to find the threads but if you do you you'll find some pretty detailed discussions about the pitfalls and some of the recommended workarounds for them. If I get time, later today, I will see if I can dig up the threads and will post the links.