public class ContinuationServlet extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) throws java.io.IOException { String reqId = req.getParameter("id"); Continuation cc = ContinuationSupport.getContinuation(req,null); res.setContentType("text/plain"); res.getWriter().println("Request: "+reqId+"\tstart:\t"+new Date()); res.getWriter().flush(); cc.suspend(2000); res.getWriter().println("Request: "+reqId+"\tend:\t"+new Date()); } }
相关的文章:
http://www.ibm.com/developerworks/cn/java/j-jettydwr/
http://www.ibm.com/developerworks/cn/java/j-lo-comet/
时间: 2024-10-10 09:33:40