使用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/
相关文章推荐
- 手游解码——《求打赏》背后的故事(1)
- 手游解码——《求打赏》背后的故事(2)
- Yii2.0 验证码的使用
- How to Write a Git Commit Message
- Moving Fast With High Code Quality - Engineering a
- 数据结构之快速排序
- Canvas绘制时钟
- Cocos2d-x
- Android
- 关于sql server2008的安装及配置
- Apache代理一个Tomcat服务器下多个项目
- opensuse linux环境下ibm_websphere和ibm_db2安装以及DB2数据迁移操
- Oracle导入dmp文件
- VIM DoxygenToolkit插件的深度定制化
- 分布式服务框架 Zookeeper -- 管理分布式环境中的数据
- Verson Magic problem
- 内存页错误
- 讲解关于Bartender的各版本
- 卓易女神重磅出击chinajoy——专享你的女神
- Storyboard使用TableView进行页面跳转传值