gpt4 book ai didi

org.glassfish.grizzly.websockets.WebSocketEngine.register()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 16:05:05 26 4
gpt4 key购买 nike

本文整理了Java中org.glassfish.grizzly.websockets.WebSocketEngine.register()方法的一些代码示例,展示了WebSocketEngine.register()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocketEngine.register()方法的具体详情如下:
包路径:org.glassfish.grizzly.websockets.WebSocketEngine
类名称:WebSocketEngine
方法名:register

WebSocketEngine.register介绍

[英]Register a WebSocketApplication to a specific context path and url pattern. If you wish to associate this application with the root context, use an empty string for the contextPath argument.

Examples: 
// WS application will be invoked: 
//    ws://localhost:8080/echo 
// WS application will not be invoked: 
//    ws://localhost:8080/foo/echo 
//    ws://localhost:8080/echo/some/path 
register("", "/echo", webSocketApplication); 
// WS application will be invoked: 
//    ws://localhost:8080/echo 
//    ws://localhost:8080/echo/some/path 
// WS application will not be invoked: 
//    ws://localhost:8080/foo/echo 
register("", "/echo/*", webSocketApplication); 
// WS application will be invoked: 
//    ws://localhost:8080/context/echo 
// WS application will not be invoked: 
//    ws://localhost:8080/echo 
//    ws://localhost:8080/context/some/path 
register("/context", "/echo", webSocketApplication);

[中]将WebSocketApplication注册到特定的上下文路径和url模式。如果希望将此应用程序与根上下文关联,请为contextPath参数使用空字符串

Examples: 
// WS application will be invoked: 
//    ws://localhost:8080/echo 
// WS application will not be invoked: 
//    ws://localhost:8080/foo/echo 
//    ws://localhost:8080/echo/some/path 
register("", "/echo", webSocketApplication); 
// WS application will be invoked: 
//    ws://localhost:8080/echo 
//    ws://localhost:8080/echo/some/path 
// WS application will not be invoked: 
//    ws://localhost:8080/foo/echo 
register("", "/echo/*", webSocketApplication); 
// WS application will be invoked: 
//    ws://localhost:8080/context/echo 
// WS application will not be invoked: 
//    ws://localhost:8080/echo 
//    ws://localhost:8080/context/some/path 
register("/context", "/echo", webSocketApplication);

代码示例

代码示例来源:origin: org.glassfish.tyrus/websocket-provider-grizzly

@Override
public SPIRegisteredEndpoint register(SPIEndpoint endpoint) {
  GrizzlyEndpoint ge =  new GrizzlyEndpoint(endpoint);
  this.engine.register(ge);
  return ge;
}

代码示例来源:origin: org.glassfish.websocket/websocket-impl

void deploy(WebSocketApplication wsa) {
  WebSocketEngine.getEngine().register(wsa);
  this.applications.add(wsa);
  logger.info("Registered a " + wsa.getClass() + " at " + ((WebSocketEndpoint) wsa).getPath());
}

代码示例来源:origin: ch.squaredesk.nova/websockets

WebSocketEngine.getEngine().register("", destinationForSubscription, app);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com