when a client disconnects from a server request prematurely, does the server still carries out rest of the work?
specifically, in a Java Servlet doGet if I have the following code:
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
{
A(); //client disconnects after A();
B();
C();
}
if client disconnects after A() is finished, would B and C still get executed?
It depends.
If during
A()(or any other method) you would attempt to send the response (usingres) back to the client,IOExceptionwould be thrown. If not caught, it would terminate the servlet execution.Otherwise the calculation would carry on and exit after
C().