本文整理汇总了Java中org.glassfish.grizzly.websockets.WebSocketAddOn类的典型用法代码示例。如果您正苦于以下问题:Java WebSocketAddOn类的具体用法?Java WebSocketAddOn怎么用?Java WebSocketAddOn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebSocketAddOn类属于org.glassfish.grizzly.websockets包,在下文中一共展示了WebSocketAddOn类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerWebsocket
import org.glassfish.grizzly.websockets.WebSocketAddOn; //导入依赖的package包/类
private void registerWebsocket() throws IOException {
Configuration configuration = ConfigurationReader.INSTANCE.readConfiguration("core-site.xml");
websocketServicePort = Integer
.parseInt(configuration.get("events.server.websocket.port", "8082"));
try {
ServerSocket s = new ServerSocket(websocketServicePort);
websocketServicePort = s.getLocalPort();
s.close();
waitTillSocketIsClosed(s);
String webSocketserviceHost = java.net.InetAddress.getLocalHost().getHostAddress();
final HttpServer server = HttpServer.createSimpleServer(null, webSocketserviceHost,
websocketServicePort);
for (NetworkListener listener : server.getListeners()) {
listener.registerAddOn(new WebSocketAddOn());
}
WebSocketEngine.getEngine().register("", "/event-stream", new EventsSocketApplication());
server.start();
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
server.shutdownNow();
}
}, "Server-Showdown-Thread"));
} catch (IOException | InterruptedException e) {
throw new IllegalStateException("Failed to start api-service. name = events.service", e);
}
}
开发者ID:DataRPM-Labs,项目名称:sigma-events,代码行数:30,代码来源:EventEngineAPIServiceStarter.java
示例2: httpServer
import org.glassfish.grizzly.websockets.WebSocketAddOn; //导入依赖的package包/类
@Bean
public HttpServer httpServer()
throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException,
FileNotFoundException, CertificateException, UnrecoverableEntryException, ConfigurationException {
HttpServer server = HttpServer.createSimpleServer("./", 8080);
WebSocketAddOn addon = new WebSocketAddOn();
server.getListeners().stream().forEach((listen) -> {
listen.registerAddOn(addon);
listen.setSecure(true);
listen.setSSLEngineConfig(
new SSLEngineConfigurator(this.sslConf()).setClientMode(false).setNeedClientAuth(false));
});
String messengerPath = configuration().getString(GlobalConfig.MESSENGER_PATH);
if (messengerPath == null) {
messengerPath = GlobalConfig.MESSENGER_PATH_DEFAULT;
}
ChatApplication application = this.chatApplication();
WebSocketEngine.getEngine().register("", messengerPath, application);
return server;
}
开发者ID:shilongdai,项目名称:LSChatServer,代码行数:23,代码来源:ApplicationRootContext.java
示例3: startServer
import org.glassfish.grizzly.websockets.WebSocketAddOn; //导入依赖的package包/类
private HttpServer startServer(URI uri) throws IOException {
ResourceConfig rc = new RallyeApplication();
HttpServer serv = createServer(uri, rc); // Do NOT start the server just yet
logger.info("Starting Grizzly server at " + uri);
//Register Websocket Stuff
WebSocketAddOn addon = new WebSocketAddOn();
for(org.glassfish.grizzly.http.server.NetworkListener listener : serv.getListeners()) {
logger.info("Registering websocket on "+listener);
listener.registerAddOn(addon);
}
PushWebsocketApp.setData(RallyeBinder.data); //TODO: Remove this ugliness.
AdminWebsocketApp.setData(RallyeBinder.data); //TODO: Remove this ugliness.
WebSocketEngine.getEngine().register("/rallye", "/push", PushWebsocketApp.getInstance());
WebSocketEngine.getEngine().register("/rallye","/admin", AdminWebsocketApp.getInstance());
serv.start();
return serv;
}
开发者ID:jakobwenzel,项目名称:rallye-server,代码行数:20,代码来源:RallyeServer.java
示例4: start
import org.glassfish.grizzly.websockets.WebSocketAddOn; //导入依赖的package包/类
@Override
public void start() throws Exception {
LOGGER.info("Starting Embedded HTTP Server...");
if (httpServer == null) {
httpServer = createHttpServer();
LOGGER.info(
String.format(Locale.ROOT,
"Jersey Application Server started with WADL available at " + "%sapplication.wadl",
getURI()));
WebSocketAddOn addon = new WebSocketAddOn();
httpServer.getListeners().forEach(listener -> listener.registerAddOn(addon));
}
httpServer.start();
}
开发者ID:MyCoRe-Org,项目名称:MyVidCoRe,代码行数:16,代码来源:EmbeddedHttpServer.java
示例5: startServer
import org.glassfish.grizzly.websockets.WebSocketAddOn; //导入依赖的package包/类
@Override
protected void startServer(int port, Action<ServerWebSocket> websocketAction) throws Exception {
server = HttpServer.createSimpleServer(null, port);
NetworkListener listener = server.getListener("grizzly");
listener.registerAddOn(new WebSocketAddOn());
WebSocketEngine.getEngine().register("", TEST_URI, new AsityWebSocketApplication()
.onwebsocket(websocketAction));
server.start();
}
开发者ID:cettia,项目名称:asity,代码行数:10,代码来源:GrizzlyServerWebSocketTest.java
示例6: startServer
import org.glassfish.grizzly.websockets.WebSocketAddOn; //导入依赖的package包/类
@Override
protected void startServer() throws Exception {
server = HttpServer.createSimpleServer(null, port);
NetworkListener listener = server.getListener("grizzly");
listener.registerAddOn(new WebSocketAddOn());
WebSocketEngine.getEngine().register("", "/test", new VibeWebSocketApplication().onwebsocket(performer.serverAction()));
server.start();
}
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:9,代码来源:GrizzlyServerWebSocketTest.java
注:本文中的org.glassfish.grizzly.websockets.WebSocketAddOn类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论