Hi,

I am using CometProcessor to stream event notifications from server to client. 
The events are generated at random.  I want to send the notification with 
Transfer Encoding as chunked so that I can use Apache's ChunkedInputStream to 
parse the output.

I get the PrintWriter from the ServletResponse using the getWriter() and I 
write the event notification on this writer. I want this to be in chunk format 
of length-payload. Currently I do the following:

PrintWriter writer = connection.getWriter();
for (int j = 0; j < pendingEvents.length; j++) {
                                String eventString = 
converter.convert(pendingEvents[j]);
                                eventString.concat("\r\n");
                                final String length = 
Integer.toHexString(eventString.length());
                                writer.print("\r\n" + length + "\r\n");
                                writer.print(eventString);
                                //logger.info("Writing:" + eventString);
}

But this generates a Bad Chunk size exception on client.

Thanking you in anticipation.

Sudeep

Reply via email to