P
Pawel
Hallo
I have the following Servlet's service code:
public void service( HttpServletRequest req, HttpServletResponse res )
throws ServletException, IOException {
PrintStream out = new PrintStream( res.getOutputStream() );
try {
while(true) {
out.println( "" );
// then sleep for 10 sec
}
} catch ( IOException e ) {
System.out.println( "problem interacting with servlet caller. Reason: " + e.getMessage() + ". Exiting..." );
return;
}
}
When I invoke that servlet from my browser I can see new lines, but when
I close it, and servlet tries to write to `out' it does not throw an exception
, it just keeps writing (!?).
I wonder how to detect that the browser was closed after my servlet was woken up.
Do You know the answer ?
Greetings.
I have the following Servlet's service code:
public void service( HttpServletRequest req, HttpServletResponse res )
throws ServletException, IOException {
PrintStream out = new PrintStream( res.getOutputStream() );
try {
while(true) {
out.println( "" );
// then sleep for 10 sec
}
} catch ( IOException e ) {
System.out.println( "problem interacting with servlet caller. Reason: " + e.getMessage() + ". Exiting..." );
return;
}
}
When I invoke that servlet from my browser I can see new lines, but when
I close it, and servlet tries to write to `out' it does not throw an exception
, it just keeps writing (!?).
I wonder how to detect that the browser was closed after my servlet was woken up.
Do You know the answer ?
Greetings.