当前位置: 首页>>代码示例>>Java>>正文


Java PermittedOptions类代码示例

本文整理汇总了Java中io.vertx.ext.web.handler.sockjs.PermittedOptions的典型用法代码示例。如果您正苦于以下问题:Java PermittedOptions类的具体用法?Java PermittedOptions怎么用?Java PermittedOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PermittedOptions类属于io.vertx.ext.web.handler.sockjs包,在下文中一共展示了PermittedOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: eventBusHandler

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private SockJSHandler eventBusHandler() {
 	SockJSHandlerOptions options = new SockJSHandlerOptions().setHeartbeatInterval(2000);
    BridgeOptions boptions = new BridgeOptions()
            .addOutboundPermitted(new PermittedOptions().setAddressRegex(MessageDefinitions.UPDATE_ORDERBOOK+":[A-Z]+-[A-Z]+"))
            .addOutboundPermitted(new PermittedOptions().setAddressRegex(MessageDefinitions.UPDATE_INDICATORS+":[A-Z]+-[A-Z]+"))
            .addOutboundPermitted(new PermittedOptions().setAddressRegex(MessageDefinitions.ORDERBOOK_READY+":[A-Z]+-[A-Z]+"))
    		.addInboundPermitted(new PermittedOptions().setAddressRegex(MessageDefinitions.GET_ORDERBOOK+":[A-Z]+-[A-Z]+"))
    		.addInboundPermitted(new PermittedOptions().setAddressRegex("getMovingAverage:[A-Z]+-[A-Z]+"))
    		.addInboundPermitted(new PermittedOptions().setAddressRegex(MessageDefinitions.REDEPLOYBITTREXVERTICLES));
    return SockJSHandler.create(vertx, options).bridge(boptions, event -> {
         if (event.type() == BridgeEventType.SOCKET_CREATED) {
            System.out.println("A socket was created!");
         } else if (event.type() == BridgeEventType.SOCKET_CLOSED){
        	 System.out.println("A socket was closed!");
         } else if (event.type() == BridgeEventType.UNREGISTER || event.type() == BridgeEventType.REGISTER){
        	 System.out.println(event.getRawMessage().encode());
         }
        event.complete(true);
    });
}
 
开发者ID:AlxGDev,项目名称:BittrexGatherer,代码行数:21,代码来源:BittrexVerticle.java

示例2: loadPlugins

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
@Override
protected void loadPlugins() {
	super.loadPlugins();
	plugins.add(new Plugin() {
		@Override
		public Single<Void> preRoute() {
			AppGlobals globals = AppGlobals.get();
			
			SockJSHandler sockJSHandler = SockJSHandler.create(globals.getVertx());
			BridgeOptions bridgeOptions = new BridgeOptions()
			  .addInboundPermitted(new PermittedOptions().setAddress("app.markdown"))
			  .addOutboundPermitted(new PermittedOptions().setAddress("page.saved"));
			sockJSHandler.bridge(bridgeOptions);
			globals.getRouter().route("/eventbus/*").handler(sockJSHandler);

			return super.preRoute();
		}
	});
}
 
开发者ID:FroMage,项目名称:redpipe,代码行数:20,代码来源:WikiServer.java

示例3: eventBusBridgeOptions

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private static BridgeOptions eventBusBridgeOptions() {

        BridgeOptions options = new BridgeOptions();

        options.setInboundPermitted(ImmutableList.of(
            new PermittedOptions().setAddress(BrowserEvents.userPositionTracking),
            new PermittedOptions().setAddress(BrowserEvents.replayUserPositions)
        ));

        options.setOutboundPermitted(ImmutableList.of(
            new PermittedOptions().setAddress(BrowserEvents.userPositionTracking),
            new PermittedOptions().setAddress(BrowserEvents.replayUserPositions)
        ));

        return options;
    }
 
开发者ID:codefacts,项目名称:Elastic-Components,代码行数:17,代码来源:TrackerServer.java

示例4: initWebSocket

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private void initWebSocket() {
    Router router = Router.router(vertx);
    SockJSHandlerOptions options = new SockJSHandlerOptions()
            .setHeartbeatInterval(1000 * 60);
    SockJSHandler sockJSHandler = SockJSHandler.create(vertx, options);

    PermittedOptions inboundPermitted = new PermittedOptions().setAddressRegex("server/.*");
    PermittedOptions outboundPermitted = new PermittedOptions().setAddressRegex("client/.*");

    BridgeOptions ops = new BridgeOptions()
            .addInboundPermitted(inboundPermitted)
            .addOutboundPermitted(outboundPermitted);

    sockJSHandler.bridge(ops);

    router.route("/eb/*").handler(sockJSHandler);
    mainRouter.mountSubRouter("/ws", router);
}
 
开发者ID:mpusher,项目名称:mpns,代码行数:19,代码来源:AppServer.java

示例5: createSockJSServer

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private void createSockJSServer(final ConfigurationContext context)  throws InitializationException {

        final int port = context.getProperty(PORT).asInteger();
        final String ContextPath = context.getProperty(CONTEXT_PATH).getValue();

        Router router = Router.router(vertx);

        SockJSHandler sockJSHandler = SockJSHandler.create(vertx);

        BridgeOptions options = new BridgeOptions();
        if (context.getProperty(INBOUND_ADDRESS_REGEX).isSet()) {
            options.addInboundPermitted(new PermittedOptions().setAddressRegex(context.getProperty(INBOUND_ADDRESS_REGEX).getValue()));
        }
        if (context.getProperty(OUTBOUND_ADDRESS_REGEX).isSet()) {
            options.addOutboundPermitted(new PermittedOptions().setAddressRegex(context.getProperty(OUTBOUND_ADDRESS_REGEX).getValue()));
        }

        sockJSHandler.bridge(options);

        router.route(ContextPath).handler(sockJSHandler);
        httpServer = vertx.createHttpServer().requestHandler(router::accept).listen(port);
    }
 
开发者ID:xmlking,项目名称:nifi-websocket,代码行数:23,代码来源:VertxService.java

示例6: serviceAndSockJS

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
public void serviceAndSockJS(Vertx vertx) {
  SomeDatabaseService service = new SomeDatabaseServiceImpl();
  ProxyHelper.registerService(SomeDatabaseService.class, vertx, service,
      "database-service-address");


  Router router = Router.router(vertx);
  // Allow events for the designated addresses in/out of the event bus bridge
  BridgeOptions opts = new BridgeOptions()
      .addInboundPermitted(new PermittedOptions()
          .setAddress("database-service-address"))
      .addOutboundPermitted(new PermittedOptions()
          .setAddress("database-service-address"));

  // Create the event bus bridge and add it to the router.
  SockJSHandler ebHandler = SockJSHandler.create(vertx).bridge(opts);
  router.route("/eventbus/*").handler(ebHandler);

  vertx.createHttpServer().requestHandler(router::accept).listen(8080);
}
 
开发者ID:vert-x3,项目名称:vertx-web,代码行数:21,代码来源:Examples.java

示例7: eventBusHandler

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private SockJSHandler eventBusHandler() {
  SockJSHandler handler = SockJSHandler.create(vertx);
  BridgeOptions options = new BridgeOptions();
  // open access
  PermittedOptions permitted = new PermittedOptions();
  options.addOutboundPermitted(permitted);
  handler.bridge(options);
  return handler;
}
 
开发者ID:glytching,项目名称:dragoman,代码行数:10,代码来源:WebServerVerticle.java

示例8: addOutboundPermitted

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private void addOutboundPermitted(BridgeOptions bridgeOptions, JsonObject outbound) {
    PermittedOptions permittedOptions=new PermittedOptions();

    permittedOptions.setAddress(outbound.getString(ADDRESS));

    String authority=outbound.getString(REQUIRED_AUTHORITY, EMPTY_CSRF_SECRET);
    if(!authority.isEmpty())
        permittedOptions.setRequiredAuthority(authority);

    bridgeOptions.addOutboundPermitted(permittedOptions);
}
 
开发者ID:GwtDomino,项目名称:domino-event-bus,代码行数:12,代码来源:VertxConfigSockJsConfigurator.java

示例9: addInboundPermitted

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private void addInboundPermitted(BridgeOptions bridgeOptions, JsonObject inbound) {
    PermittedOptions permittedOptions=new PermittedOptions();

    permittedOptions.setAddress(inbound.getString(ADDRESS));

    String authority=inbound.getString(REQUIRED_AUTHORITY, EMPTY_CSRF_SECRET);
    if(!authority.isEmpty())
        permittedOptions.setRequiredAuthority(authority);

    bridgeOptions.addInboundPermitted(permittedOptions);
}
 
开发者ID:GwtDomino,项目名称:domino-event-bus,代码行数:12,代码来源:VertxConfigSockJsConfigurator.java

示例10: configure

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
@Override
public SockJSHandler configure(VertxContext vertxContext, ServerConfiguration<JsonObject, JsonObject[]> config) {
    BridgeOptions bridgeOptions=new BridgeOptions();
    bridgeOptions.addOutboundPermitted(new PermittedOptions().setAddress(VertxBusContext.DEFAULT_SOCKJS_ADDRESS));

    SockJSHandler sockJSHandler = SockJSHandler.create(vertxContext.vertx());
    sockJSHandler.bridge(bridgeOptions, event -> event.complete(true));

    sockJSHandler.socketHandler(event -> event.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, ALLOW_ALL));
    return sockJSHandler;
}
 
开发者ID:GwtDomino,项目名称:domino-event-bus,代码行数:12,代码来源:DefaultEventBusSockJsConfigurator.java

示例11: eventBusHandler

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
private SockJSHandler eventBusHandler() {
	BridgeOptions options = new BridgeOptions().addOutboundPermitted(new PermittedOptions().setAddressRegex(".*"));
	return SockJSHandler.create(vertx).bridge(options, event -> {
		if (event.type() == BridgeEventType.SOCKET_CREATED) {
			logger.info("A socket was created");
		}
		event.complete(true);
	});
}
 
开发者ID:simonemasoni,项目名称:vertx_spring,代码行数:10,代码来源:RestVerticle.java

示例12: start

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
@Start
public void start() {
	SockJSHandler sockJSHandler = SockJSHandler.create(vertx);
	BridgeOptions options = new BridgeOptions();
	PermittedOptions chatPermission = new PermittedOptions().setAddress("chat");
	PermittedOptions outboundPermitted1 = new PermittedOptions().setAddress("chat");
	
	options.addInboundPermitted(chatPermission);
	options.addOutboundPermitted(outboundPermitted1);
	sockJSHandler.bridge(options);

	Route route = router.route("/eventbus/*");
	routes.add(route);
	route.handler(sockJSHandler);
}
 
开发者ID:paulbakker,项目名称:osgi-vertx-demo,代码行数:16,代码来源:SockJs.java

示例13: start

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
@Override
public void start() throws Exception {

    // Vert.x Web  router
    Router router = Router.router(vertx);

    // Routes definition
    router.get().path("/temp/:sensorId").handler(this::handlerGetTemp);
    router.put().path("/led").handler(this::handlerPutLed);

    // Setting Bridge permissions
    BridgeOptions options = new BridgeOptions()
            .addInboundPermitted(new PermittedOptions().setAddress("sensor-temp"))
            // all outbound messages are permitted
            .addOutboundPermitted(new PermittedOptions());

    router.route("/eventbus/*").handler(SockJSHandler.create(vertx).bridge(options));

    // Serve static Files from webroot dir
    router.route().handler(StaticHandler.create());

    vertx.createHttpServer()
            .requestHandler(router::accept)
            .listen(8000, event -> {
                log.info("HTTP Server started on port 8000");
            });

}
 
开发者ID:lhuet,项目名称:vertxOnRpiAndOdroid,代码行数:29,代码来源:HttpVerticle.java

示例14: start

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
@Override
public void start() throws Exception {
  super.start();
  Router router = Router.router(vertx);

  // create Dropwizard metrics service
  MetricsService service = MetricsService.create(vertx);

  // event bus bridge
  SockJSHandler sockJSHandler = SockJSHandler.create(vertx);
  BridgeOptions options = new BridgeOptions()
    .addOutboundPermitted(new PermittedOptions().setAddress("microservice.monitor.metrics"))
    .addOutboundPermitted(new PermittedOptions().setAddress("events.log"));

  sockJSHandler.bridge(options);
  router.route("/eventbus/*").handler(sockJSHandler);

  // discovery endpoint
  ServiceDiscoveryRestEndpoint.create(router, discovery);

  // static content
  router.route("/*").handler(StaticHandler.create());

  int port = config().getInteger("monitor.http.port", 9100);
  String host = config().getString("monitor.http.host", "0.0.0.0");
  int metricsInterval = config().getInteger("monitor.metrics.interval", 5000);

  vertx.createHttpServer()
    .requestHandler(router::accept)
    .listen(port, host);

  // send metrics message to the event bus
  vertx.setPeriodic(metricsInterval, t -> {
    JsonObject metrics = service.getMetricsSnapshot(vertx);
    vertx.eventBus().publish("microservice.monitor.metrics", metrics);
  });
}
 
开发者ID:sczyh30,项目名称:vertx-blueprint-microservice,代码行数:38,代码来源:MonitorDashboardVerticle.java

示例15: start

import io.vertx.ext.web.handler.sockjs.PermittedOptions; //导入依赖的package包/类
@Override
public void start() {
	// Initialize the router and a webserver with HTTP-compression
	Router router = Router.router(vertx);

	PermittedOptions freewayOK = new PermittedOptions().setAddress(Client.freeway);
	PermittedOptions myDtoOK = new PermittedOptions().setAddress(Client.addressPojo);
	BridgeOptions firewall = new BridgeOptions().addInboundPermitted(freewayOK).addOutboundPermitted(freewayOK)
			.addInboundPermitted(myDtoOK).addOutboundPermitted(myDtoOK);
	router.route("/chatEventbus/*").handler(SockJSHandler.create(vertx).bridge(firewall
	// If you want to know the sender, add it as header:
	// , be -> {
	// if (be.type() == BridgeEventType.RECEIVE || be.type() ==
	// BridgeEventType.PUBLISH) {
	// JsonObject headers = be.getRawMessage().getJsonObject("headers");
	// if (headers == null) {
	// headers = new JsonObject();
	// be.getRawMessage().put("headers", headers); }
	// headers.put("sender", be.socket().writeHandlerID()); }
	// be.complete(true); }
	));

	// to broadcast: vertx.eventBus().publish(Client.freeway,"Bla");
	// to receive: vertx.eventBus().consumer(Client.freeway, m -> ... );
	// broadcasting to everyone is done automaticly by .publish()

	// extra: pojo example
	Pojofy.eventbus(Client.addressPojo, Dto.class, this::serviceDoSomething);

	AllExamplesServer.start(Client.class, router);
}
 
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:32,代码来源:ExampleChatEventbus.java


注:本文中的io.vertx.ext.web.handler.sockjs.PermittedOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。