您的位置:首页 > 其它

使用jetty实现服务器端推的技术

2015-07-28 00:00 453 查看
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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: