users@grizzly.java.net

getWriter() has already been called for this response

From: Aart de Vries <aartdv_at_premier-gps.com>
Date: Tue, 07 Oct 2008 08:04:07 -0600

Yes, Mo Rock's code sample from may 28th in the article "GWT + Grizzly +
Comet" uses getWriter() in their SimpleServiceServlet sample, as follows:

    /**
     * Write the response payload to the response stream.
     */
    public void writeResponse(HttpServletRequest request,
HttpServletResponse response, String responsePayload) throws IOException {
         PrintWriter writer = response.getWriter();
         writer.write(responsePayload);
         writer.flush();
    }

To resolve my problem, I replaced this with:
     protected boolean shouldCompressResponse(HttpServletRequest
request, HttpServletResponse response, String responsePayload) {
        return
RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);
    }

    public void writeResponse(HttpServletRequest request,
HttpServletResponse response, String responsePayload) throws IOException {
        boolean gzipEncode =
RPCServletUtils.acceptsGzipEncoding(request) &&
shouldCompressResponse(request, response, responsePayload);
        RPCServletUtils.writeResponse(getServletContext(), response,
responsePayload, gzipEncode);
   }


I already a request to Mo Rock's site to change their sample code that
they make available for download.

Thanks Jeanfrancois.