本文整理汇总了Java中org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry类的典型用法代码示例。如果您正苦于以下问题:Java WebSocketHandlerRegistry类的具体用法?Java WebSocketHandlerRegistry怎么用?Java WebSocketHandlerRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebSocketHandlerRegistry类属于org.springframework.web.socket.config.annotation包,在下文中一共展示了WebSocketHandlerRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
/**
* 支持websocket 的 connection
*/
registry.addHandler(binaryGeometryTemplateSocketHandler,"/ws/binarygeometry/template").setAllowedOrigins("*").addInterceptors(new BinaryGeometryTemplateInterceptor());
/**
* 如不支持websocket的connenction,采用sockjs
*/
registry.addHandler(geometrySocketHandler,"/ws/geometry").setAllowedOrigins("*").addInterceptors(new GeometryInterceptor());
//.withSockJS();
registry.addHandler(streamGeometrySocketHandler,"/ws/streamgeometry").setAllowedOrigins("*").addInterceptors(new StreamGeometryInterceptor());
}
示例2: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER);
policy.setMaxTextMessageBufferSize(MAX_MSG_SIZE);
policy.setMaxTextMessageSize(MAX_MSG_SIZE);
policy.setIdleTimeout(IDLE_TIMEOUT);
OcppWebSocketUpgrader upgradeStrategy = new OcppWebSocketUpgrader(
policy, ocpp12WebSocketEndpoint, ocpp15WebSocketEndpoint, chargePointRepository);
DefaultHandshakeHandler handler = new DefaultHandshakeHandler(upgradeStrategy);
handler.setSupportedProtocols(PROTOCOLS);
registry.addHandler(ocpp12WebSocketEndpoint, "/websocket/CentralSystemService/*")
.addHandler(ocpp15WebSocketEndpoint, "/websocket/CentralSystemService/*")
.setHandshakeHandler(handler)
.setAllowedOrigins("*");
}
示例3: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry
.addHandler(notificationHandler(), "/teapots")
.addHandler(teapotHandler(), "/teapots/register/{teapotId}")
.addHandler(consoleHandler(), "/teapots/{teapotId}")
.setAllowedOrigins("*") // allow all origins
.addInterceptors(new UriTemplateHandshakeInterceptor());
}
示例4: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
WebSocketPolicy policy = new WebSocketPolicy(WebSocketBehavior.SERVER);
policy.setMaxTextMessageBufferSize(MAX_MSG_SIZE);
policy.setMaxTextMessageSize(MAX_MSG_SIZE);
policy.setIdleTimeout(IDLE_TIMEOUT);
OcppWebSocketUpgrader upgradeStrategy = new OcppWebSocketUpgrader(
policy, ocpp12WebSocketEndpoint, ocpp15WebSocketEndpoint, chargePointRepository, notificationService);
DefaultHandshakeHandler handler = new DefaultHandshakeHandler(upgradeStrategy);
handler.setSupportedProtocols(PROTOCOLS);
registry.addHandler(ocpp12WebSocketEndpoint, "/websocket/CentralSystemService/*")
.addHandler(ocpp15WebSocketEndpoint, "/websocket/CentralSystemService/*")
.setHandshakeHandler(handler)
.setAllowedOrigins("*");
}
示例5: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
if (AppConfig.isNonInteractive) {
return;
}
registry.addHandler(new WebSocketHandler(), "/ws").withSockJS()
.setClientLibraryUrl("https://cdn.jsdelivr.net/sockjs/1.1.4/sockjs.min.js");
}
示例6: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(new HotlineSocketHandler(), "/data");
}
示例7: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(myHandler(), "/ws")
.addInterceptors(new HandshakeInterceptor());
registry.addHandler(myHandler(), "/ws/sockjs")
.addInterceptors(new HandshakeInterceptor()).withSockJS();
}
示例8: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(new JavametricsSpringSocketHandler(), "javametrics-dash/javametrics-socket");
}
示例9: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
String[] beans = context.getBeanNamesForAnnotation(WSHandler.class);
for (String bean : beans) {
WebSocketHandler handler = context.getBean(bean, WebSocketHandler.class);
String[] path = handler.getClass().getAnnotation(WSHandler.class).value();
registry.addHandler(handler, path).setAllowedOrigins("*").withSockJS();
LOGGER.info("[WebSocket]注册 WebSocket path {} 到 {}", path, bean);
}
}
示例10: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
MessageRouter jsonMessageRouter = this.jsonMessageRouter();
registry.addHandler(jsonMessageRouter, "/ws")
.addInterceptors(httpSessionHandshakeInterceptor())
.setAllowedOrigins("*");
jsonMessageRouter.addHandler(serverMessageHandler());
}
示例11: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
protected void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
CommandWebSocketMessageDispatcher dispatcher = new CommandWebSocketMessageDispatcher();
dispatcher.setProcessorContainer(commandProcessorContainer);
dispatcher.setUserTokenManager(userTokenManager);
dispatcher.setWebSocketSessionListeners(webSocketSessionListeners);
dispatcher.setTokenParsers(webSocketTokenParsers);
registry.addHandler(dispatcher, "/sockjs")
.setAllowedOrigins(allowedOrigins)
.withSockJS()
.setSessionCookieNeeded(true);
registry.addHandler(dispatcher, "/socket")
.setAllowedOrigins(allowedOrigins);
}
示例12: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry
.addHandler(spectateWebSocketHandler(), "/ws/spectate")
.withSockJS()
.setInterceptors(spectateHandshakeInterceptor());
}
示例13: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(echoWebSocketHandler(), "/echo").setAllowedOrigins("*")
.withSockJS();
registry.addHandler(snakeWebSocketHandler(), "/snake").setAllowedOrigins("*")
.withSockJS();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:SampleUndertowWebSocketsApplication.java
示例14: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(echoWebSocketHandler(), "/echo").setAllowedOrigins("*").withSockJS();
registry.addHandler(greetingWebSocketHandler(), "/hello").setAllowedOrigins("*").withSockJS();
registry.addHandler(closeWithCodeWebSocketHandler(), "/code").setAllowedOrigins("*").withSockJS();
registry.addHandler(randomByteStreamWebSocketHandler(), "/stream").setAllowedOrigins("*").withSockJS();
}
示例15: registerWebSocketHandlers
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; //导入依赖的package包/类
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
//@formatter:off
registry
.addHandler(clearHandler, clrPath)
.addHandler(encHandler, encPath)
.addInterceptors(new HttpSessionHandshakeInterceptor())
.setHandshakeHandler(createHandshakeHandler());
//@formatter:on
}