package com.huatech.messageremind.service;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;
import org.directwebremoting.Container;
import org.directwebremoting.ServerContextFactory;
import org.directwebremoting.WebContextFactory;
import org.directwebremoting.event.ScriptSessionEvent;
import org.directwebremoting.event.ScriptSessionListener;
import org.directwebremoting.extend.ScriptSessionManager;
import org.directwebremoting.servlet.DwrServlet;
public class DwrScriptSessionManagerUtil extends DwrServlet{
private static final long serialVersionUID = -7504612622407420071L;
public void init()throws ServletException {
Container container = ServerContextFactory.get().getContainer();
ScriptSessionManager manager = container.getBean(ScriptSessionManager.class);
ScriptSessionListener listener = new ScriptSessionListener() {
public void sessionCreated(ScriptSessionEvent ev) {
HttpSession session = WebContextFactory.get().getSession();
String userId =((User) session.getAttribute("userinfo")).getHumanid()+"";
System.out.println("用户id为"+userId+"ScriptSession创建成功!");
ev.getSession().setAttribute("userId", userId);
}
public void sessionDestroyed(ScriptSessionEvent ev) {
System.out.println("ScriptSession已经销毁");
}
};
manager.addScriptSessionListener(listener);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
DWR服务器向指定浏览器发送消息(!!!不是所有浏览器)
共34个文件
class:9个
java:6个
jsp:3个
需积分: 10 7 下载量 104 浏览量
2018-02-05
17:11:18
上传
评论
收藏 1.2MB ZIP 举报
温馨提示
详细说明地址:http://blog.csdn.net/weixin_39549656/article/details/79262105
资源详情
资源评论
资源推荐
收起资源包目录
DWR向指定浏览器发送信息.zip (34个子文件)
WebContent
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 2KB
dwr.xml 807B
lib
commons-logging-1.1.1.jar 59KB
dwr.jar 1.13MB
dwr
engine.js 45KB
util.js 45KB
js
jquery-1.5.1.js 212KB
login.jsp 684B
index.jsp 1KB
MyJsp.jsp 2KB
.settings
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 345B
org.eclipse.wst.common.component 458B
org.eclipse.wst.jsdt.ui.superType.container 49B
.jsdtscope 567B
org.eclipse.jdt.core.prefs 364B
src
com
test
dwr
bean
Message.java 411B
servlet
servlet
LoginAction.java 1KB
huatech
messageremind
service
DwrScriptSessionManagerUtil.java 2KB
User.java 416B
MessagePush.java 762B
Test.java 1KB
.project 1KB
.classpath 842B
build
classes
com
test
dwr
bean
Message.class 730B
servlet
servlet
LoginAction.class 2KB
huatech
messageremind
service
Test.class 1KB
User.class 763B
DwrScriptSessionManagerUtil.class 1KB
MessagePush.class 1KB
DwrScriptSessionManagerUtil$1.class 2KB
Test$1.class 1KB
Test$2.class 2KB
共 34 条
- 1
仅次于鹰
- 粉丝: 137
- 资源: 58
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于python部署fastsam的tensorrt模型源码.zip
- 【JavaScript】基于JSP的酒店客房管理系统源【源码+lw+部署文档+讲解】
- 综合电路设计-8赛道多功能运动秒表(vivado实现代码)
- java学习心得4000字.doc
- CarControl.pcf
- opencv-基于c++实现的opencv图像处理算法之gamma校正.zip
- java实习周记25篇.doc
- MI4450-VB一款SOP8封装N-Channel场效应MOS管
- opencv-基于c++实现的opencv图像处理算法之灰度变换算法.zip
- 实现用于Landmark检测+Robot跟踪的SLAM定位导航算法源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0