dev@glassfish.java.net

Re: Servlet writing of response is not terminated when client terminates the request

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 28 May 2008 17:48:37 +0200

Oleksiy Stashok wrote:
>>
> Hi Paul,
>
> it's not Grizzly issue, as Grizzly fairly throws BrokenPipeException,

I was using GFv2 when i tried with response.getOutputStream(), and
wrapping that around OutputStreamWriter, or using response.getWriter()
they all failed. When i used GFv2 UR2 only the last one failed.


> and seems PrintWriter implementation just eats it.


Ah! I just looked at the source for PrintWriter and it does indeed catch
the IOException and do nothing with it!!


> I've run the similar Servlet, but used response.getOutputStream()
> instead of PrintWriter - and it works fine.
>

OK.

I still think there may be a different bug with GFv2 UR2 though, if i
try and un-deploy the application that uses PrintWriter, the thread
doing the writing is still running, i.e. i need to stop the the server.

Arguably our servlet implementation should be throwing a runtime
exception when the connection is closed when the developer is using the
response.getWriter().

Thanks,
Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109