Hello,
I'm trying to call read event by sending post request to servlets in Tomcat.
The code which I'm using in client side is in jquery
$.post('just.do',{username:value},function(data){
$('#div').html(data);
}
);
but whenever I make a post request I get a response "Oh no" of begin event. I've not closed any connection in between a request so how I call read event?
public void event(CometEvent event)
throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
HttpServletResponse response = event.getHttpServletResponse();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
PrintWriter out = response.getWriter();
out.println("Oh no");
out.flush();
} else if (event.getEventType() == CometEvent.EventType.READ) {
PrintWriter out = response.getWriter();
out.println("Hello");
out.flush();
}
}