使用jetty實現服務器端推的技術

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());
	  }
	}

相關的文章:
java

http://www.ibm.com/developerworks/cn/java/j-jettydwr/ code

http://www.ibm.com/developerworks/cn/java/j-lo-comet/get

相關文章
相關標籤/搜索