users@glassfish.java.net

Re: Missing ClientAbortException on small responses

From: <paab_at_mbricks.no>
Date: Tue, 28 Oct 2008 07:18:11 -0700 (PDT)

Sorry I forgot to say that this was related to a HttpServlet handling a
doPost(HttpServletRequest request, HttpServletResponse response).

This is my source code:

// Read how much data we wrote and set the http content-length
                        // header
                        outputStream.flush();
                        contentLength = outputStream.size();

                        // Build a response
                        response.setStatus(HttpServletResponse.SC_OK);
                        response.setContentType("application/octet-stream");
                        response.setCharacterEncoding("UTF-8");
                        response.setContentLength(contentLength);

                        // Write the data to the http output stream and close it
                        ServletOutputStream responseStream = response.getOutputStream();
                        outputStream.writeTo(responseStream);

                        // write everything to the client
                        response.flushBuffer();

                        // close the stream
                        responseStream.close();



paab_at_mbricks.no wrote:
>
> I need to know whether the response created is received by the client. If
> the client for some reason drops the connection during the write back
> process I was excepting a ClientAbortException, but this do not occur for
> all responses. I'm guess it has something to do with the size of the
> response?
>
> Any idea how to get this exception also for responses of such a couple of
> bytes?
>
> Pål
>
>
>

-- 
View this message in context: http://www.nabble.com/Missing-ClientAbortException-on-small-responses-tp20208041p20208100.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.