As far as I can see, for normal Http request simply pressing escape-key or browser's stop button, nullifies the previous request. So, why not in Ajax. I am not sure how are you implementing the Ajax functionality, but I assume you are using some framework like, JQuery, Prototype, ExtJS etc.. After a bit of Google search, I got to know that these libraries have an abort() like function to abort Ajax request request. You might want to look the source code, to know what is there exactly.
You may be able to cancel the request as far as the client browser is concerned but the Thread executing the request on the server will NOT notice this until it tries to output to the response.
Therefore, you might have that long running Thread periodically send some text to the response and flush the output stream. This will get you an exception, aborting the long running process, because the socket has been closed.
It is much better practice to start a separate Thread for long running processes - see many many discussions on the Ranch of this problem.
subject: how to get refrance of a current executing thread of a servlet