package web.webSocket.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import web.webSocket.hndler.SystemWebSocketHandler;
import web.webSocket.interceptor.HandshakeInterceptor;
@Configuration
@EnableWebMvc
@EnableWebSocket
public class WebSocketConfig extends WebMvcConfigurerAdapter implements
WebSocketConfigurer {
public WebSocketConfig() {
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(systemWebSocketHandler(), "/websck").addInterceptors(new HandshakeInterceptor());
System.out.println("registed!");
registry.addHandler(systemWebSocketHandler(), "/sockjs/websck/info").addInterceptors(new HandshakeInterceptor())
.withSockJS();
}
@Bean
public WebSocketHandler systemWebSocketHandler() {
//return new InfoSocketEndPoint();
return new SystemWebSocketHandler();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
myeclipse+spring+websocket+sockjs(非maven项目)
共47个文件
jar:26个
java:4个
class:4个
5星 · 超过95%的资源 需积分: 47 131 下载量 46 浏览量
2016-11-11
11:56:38
上传
评论 1
收藏 8.91MB RAR 举报
温馨提示
简单demo,myeclipse+spring+websocket+sockjs(非maven项目),解压部署就能用,jdk1.7,tomcat7.0或者以上
资源推荐
资源详情
资源评论
收起资源包目录
webSocketTest.rar (47个子文件)
webSocketTest
.project 1KB
src
web
webSocket
hndler
SystemWebSocketHandler.java 1KB
InfoSocketEndPoint.java 768B
config
WebSocketConfig.java 1KB
interceptor
HandshakeInterceptor.java 1KB
WebRoot
WEB-INF
applicationContext.xml 3KB
classes
web
webSocket
hndler
SystemWebSocketHandler.class 3KB
InfoSocketEndPoint.class 1KB
config
WebSocketConfig.class 2KB
interceptor
HandshakeInterceptor.class 2KB
lib
servlet-api.jar 193KB
spring-jms-4.0.4.RELEASE.jar 206KB
spring-tx-4.3.3.RELEASE.jar 261KB
spring-core-4.3.3.RELEASE.jar 1.06MB
spring-messaging-4.3.3.RELEASE.jar 372KB
spring-oxm-4.3.3.RELEASE.jar 83KB
spring-web-4.3.3.RELEASE.jar 794KB
spring-context-support-4.3.3.RELEASE.jar 183KB
spring-websocket-4.3.3.RELEASE.jar 439KB
spring-expression-4.3.3.RELEASE.jar 258KB
spring-data-redis-1.4.2.RELEASE.jar 637KB
spring-orm-4.3.3.RELEASE.jar 466KB
spring-jdbc-4.3.3.RELEASE.jar 416KB
spring-build-src-4.0.4.RELEASE.jar 71KB
jackson-databind-2.2.1.jar 845KB
spring-instrument-4.3.3.RELEASE.jar 7KB
spring-test-4.0.4.RELEASE.jar 438KB
commons-logging-1.1.3.jar 61KB
jackson-annotations-2.2.1.jar 33KB
spring-webmvc-4.3.3.RELEASE.jar 892KB
spring-aop-4.3.3.RELEASE.jar 371KB
spring-beans-4.3.3.RELEASE.jar 743KB
jackson-core-2.2.1.jar 188KB
spring-context-4.3.3.RELEASE.jar 1.08MB
spring-webmvc-portlet-4.3.3.RELEASE.jar 173KB
spring-aspects-4.3.3.RELEASE.jar 57KB
web.xml 2KB
dispatcher-servlet.xml 1KB
META-INF
MANIFEST.MF 39B
testSocket.jsp 6KB
.settings
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.common.project.facet.core.xml 401B
org.eclipse.jdt.core.prefs 364B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.component 498B
.jsdtscope 522B
.classpath 974B
共 47 条
- 1
qq_16086191
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页