Hi,
i'm using jetty-7.4.1.v20110513 and servlet-api-2.5
i tried to use continations in the following servlet.
import java.io.*;
import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.continuation.*;
public class cs extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res)
throws java.io.IOException {
String reqId = req.getParameter("id");
Continuation cc = ContinuationSupport.getContinuation(req);
res.setContentType("text/plain");
res.getWriter().println("Request: "+reqId+"\tstart:\t"+new Date());
res.getWriter().flush();
cc.setTimeout(2000);
cc.suspend();
res.getWriter().println("Request: "+reqId+"\tend:\t"+new Date());
cc.complete();
}
}
I'm expecting a 2 sec delay but when i deploy the servlet in jetty, i'm getting output in the browser as following without any delay:
Request: null start: Sat May 21 15:25:02 IST 2011
Request: null end: Sat May 21 15:25:02 IST 2011
please help.
Thanks,
ravi.