Hi,
I'm trying to use Comet in tomcat 6.0.10, and have the following test class:
public class CometServlet extends HttpServlet implements CometProcessor {
public void event(final CometEvent event) throws IOException,
ServletException {
final HttpServletRequest request = event.getHttpServletRequest();
final HttpServletResponse response = event.getHttpServletResponse();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
throw new ServletException("test message");
} else if (event.getEventType() == CometEvent.EventType.ERROR) {
// ...
event.close();
} else if (event.getEventType() == CometEvent.EventType.END) {
// ...
event.close();
} else if (event.getEventType() == CometEvent.EventType.READ) {
// ...
}
}
}
When I make a request to Tomcat and set a breakpoint on the event
method, I see that I get a BEGIN event and the servlet exception is
thrown. The exception appears in my Tomcat log. However, the client
connection is not terminated. Instead, after waiting for a while, I get
another event: the ERROR/TIMEOUT event. The call to event.close() then
causes the request to be finished, and the client gets a 200 response
with an empty body.
The behavior I am trying to create is different though: I would like a
500 response to the client as soon as the error condition arises (the
exception is thrown). I tried a try { throw exception; } finally {
event.close(); }, but it seems that event.close() causes a 200 response
no matter what.
How do I get the CometProcessor to give the client a 500 response
immediately? Note that I have not written anything to the response, so
it is not comitted yet.
Thanks for any help/pointers,
Sebastiaan
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]