Codota Logo
BridgeOptions.<init>
Code IndexAdd Codota to your IDE (free)

How to use
io.vertx.ext.web.handler.sockjs.BridgeOptions
constructor

Best Java code snippets using io.vertx.ext.web.handler.sockjs.BridgeOptions.<init> (Showing top 20 results out of 315)

  • Common ways to obtain BridgeOptions
private void myMethod () {
BridgeOptions b =
  • Codota Iconnew BridgeOptions()
  • Smart code suggestions by Codota
}
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  Router router = Router.router(vertx);

  // Allow events for the designated addresses in/out of the event bus bridge
  BridgeOptions opts = new BridgeOptions()
    .addOutboundPermitted(new PermittedOptions().setAddress("feed"));

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

  // Start the web server and tell it to use the router to handle requests.
  vertx.createHttpServer().requestHandler(router).listen(8080);

  EventBus eb = vertx.eventBus();

  vertx.setPeriodic(1000l, t -> {
   // Create a timestamp string
   String timestamp = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(Date.from(Instant.now()));

   eb.send("feed", new JsonObject().put("now", timestamp));
  });
 }
}
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  Router router = Router.router(vertx);

  // Allow events for the designated addresses in/out of the event bus bridge
  BridgeOptions opts = new BridgeOptions()
   .addOutboundPermitted(new PermittedOptions().setAddress("feed"));

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

  // Create a router endpoint for the static content.
  router.route().handler(StaticHandler.create());

  // Start the web server and tell it to use the router to handle requests.
  vertx.createHttpServer().requestHandler(router).listen(8080);

  EventBus eb = vertx.eventBus();

  vertx.setPeriodic(1000l, t -> {
   // Create a timestamp string
   String timestamp = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(Date.from(Instant.now()));

   eb.send("feed", new JsonObject().put("now", timestamp));
  });
 }
}
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  Router router = Router.router(vertx);

  // Allow events for the designated addresses in/out of the event bus bridge
  BridgeOptions opts = new BridgeOptions()
    .addOutboundPermitted(new PermittedOptions().setAddress("feed"));

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

  // Create a router endpoint for the static content.
  router.route().handler(StaticHandler.create());

  // Start the web server and tell it to use the router to handle requests.
  vertx.createHttpServer().requestHandler(router).listen(8080);

  EventBus eb = vertx.eventBus();

  vertx.setPeriodic(1000l, t -> {
   // Create a timestamp string
   String timestamp = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(Date.from(Instant.now()));

   eb.send("feed", new JsonObject().put("now", timestamp));
  });
 }
}
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  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("com.example:cmd:poke-server"))
    .addOutboundPermitted(new PermittedOptions().setAddress("com.example:stat:server-info"));

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

  // Create a router endpoint for the static content.
  router.route().handler(StaticHandler.create());

  // Start the web server and tell it to use the router to handle requests.
  vertx.createHttpServer().requestHandler(router).listen(8080);

  EventBus eb = vertx.eventBus();

  vertx.setPeriodic(1000l, t -> {
   // Create a timestamp string
   String timestamp = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(Date.from(Instant.now()));
   eb.send("com.example:stat:server-info", new JsonObject().put("systemTime", timestamp));
  });
 }
}
origin: vert-x3/vertx-examples

BridgeOptions options = new BridgeOptions();
options.setOutboundPermitted(Collections.singletonList(new PermittedOptions().setAddress("dashboard")));
router.route("/eventbus/*").handler(SockJSHandler.create(vertx).bridge(options));
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  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("chat.message"))
      .addOutboundPermitted(new PermittedOptions().setAddress("chat.message"));

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

  // Create a router endpoint for the static content.
  router.route().handler(StaticHandler.create());

  // Start the web server and tell it to use the router to handle requests.
  vertx.createHttpServer().requestHandler(router).listen(8080);
 }
}
origin: vert-x3/vertx-examples

BridgeOptions opts = new BridgeOptions()
 .addInboundPermitted(new PermittedOptions().setAddress("chat.to.server"))
 .addOutboundPermitted(new PermittedOptions().setAddress("chat.to.client"));
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  // Create the client object
  MyService service = new MyServiceImpl();

  // Register the handler
  new ServiceBinder(vertx)
    .setAddress("proxy.example")
    .register(MyService.class, service);

  Router router = Router.router(vertx);

  BridgeOptions options = new BridgeOptions().addInboundPermitted(new PermittedOptions().setAddress("proxy.example"));

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

  // Serve the static resources
  router.route().handler(StaticHandler.create());

  vertx.createHttpServer().requestHandler(router).listen(8080);
 }
}
origin: vert-x3/vertx-examples

BridgeOptions options = new BridgeOptions().addOutboundPermitted(new PermittedOptions().setAddress("news-feed"));
origin: vert-x3/vertx-examples

@Override
public void start() throws Exception {
 // Create the client object
 ProcessorService service = new ProcessorServiceImpl();
 // Register the handler
 new ServiceBinder(vertx)
  .setAddress("vertx.processor")
  .register(ProcessorService.class, service);
 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("vertx.processor"))
   .addOutboundPermitted(new PermittedOptions().setAddress("vertx.processor"));
 // Create the event bus bridge and add it to the router.
 SockJSHandler ebHandler = SockJSHandler.create(vertx).bridge(opts);
 
 router.route("/eventbus/*").handler(ebHandler);
 router.route().handler(StaticHandler.create());
 //
 vertx.createHttpServer().requestHandler(router).listen(8080);
}
origin: vert-x3/vertx-examples

BridgeOptions options = new BridgeOptions().
  addOutboundPermitted(
    new PermittedOptions().
origin: vert-x3/vertx-examples

BridgeOptions options = new BridgeOptions()
origin: vert-x3/vertx-web

@Test
public void testMaxAddressLength() throws Exception {
 CountDownLatch latch = new CountDownLatch(1);
 sockJSHandler.bridge(new BridgeOptions(allAccessOptions).setMaxAddressLength(10));
 client.websocket(websocketURI, ws -> {
  JsonObject msg = new JsonObject().put("type", "register").put("address", "someaddressyqgyuqwdyudyug");
  ws.writeFrame(io.vertx.core.http.WebSocketFrame.textFrame(msg.encode(), true));
  ws.handler(buff -> {
   String str = buff.toString();
   JsonObject received = new JsonObject(str);
   assertEquals("err", received.getString("type"));
   assertEquals("max_address_length_reached", received.getString("body"));
   latch.countDown();
  });
 });
 awaitLatch(latch);
}
origin: vert-x3/vertx-web

sockJSHandler.bridge(new BridgeOptions(allAccessOptions).setMaxHandlersPerSocket(maxHandlers));
origin: vert-x3/vertx-web

 @Test
 public void testInvalidMessageCode() {
  router.route("/ws-timeout/*").handler(SockJSHandler
   .create(vertx)
   .bridge(new BridgeOptions().addInboundPermitted(new PermittedOptions().setAddress("SockJSHandlerTest.testInvalidMessageCode")))
  );

  vertx.eventBus().consumer("SockJSHandlerTest.testInvalidMessageCode", msg -> msg.reply(new JsonObject()));

  client.websocket("/ws-timeout/websocket", ws -> {
   ws.writeFinalBinaryFrame(Buffer.buffer("durp!"));

   ws.frameHandler(frame -> {
    // we should get a normal frame with a error message
    if (!frame.isClose()) {
     JsonObject msg = new JsonObject(frame.binaryData());
     assertEquals("err", msg.getString("type"));
     assertEquals("invalid_json", msg.getString("body"));
     testComplete();
     ws.close();
    }
   });
  });
  await();
 }
}
origin: advantageous/qbit

@Override
public void start() throws Exception {
  /* test service */
  final TestService testService = new TestService();
  /* address */
  final String address = "testservice";
  /* service builder */
  final ServiceBuilder serviceBuilder = ServiceBuilder.serviceBuilder();
  serviceBuilder.setServiceObject(testService);
  final ServiceQueue serviceQueue = serviceBuilder.build();
  /* vertx event bus bridge to qbit. */
  final VertxEventBusBridgeBuilder vertxEventBusBridgeBuilder = VertxEventBusBridgeBuilder
      .vertxEventBusBridgeBuilder()
      .setVertx(vertx);
  vertxEventBusBridgeBuilder.addBridgeAddress(address, TestService.class);
  final Router router = Router.router(vertx);
  router.route("/health/").handler(routingContext -> routingContext.response().end("\"ok\""));
    /* Configure bridge at this HTTP/WebSocket URI. */
  router.route("/eventbus/*").handler(SockJSHandler.create(vertx).bridge(
      new BridgeOptions()
          .addInboundPermitted(new PermittedOptions().setAddress(address))
          .addOutboundPermitted(new PermittedOptions().setAddress(address))
  ));
  vertxEventBusBridgeBuilder.setServiceQueue(serviceQueue);
  serviceQueue.startAll(); //startall not supported yet for bridge.
  vertxEventBusBridgeBuilder.build();
  vertx.createHttpServer().requestHandler(router::accept).listen(8080);
  System.out.println("Bound to 8080");
}
origin: vert-x3/vertx-web

@Test
public void testTimeoutCloseCode() {
 router.route("/ws-timeout/*").handler(SockJSHandler
  .create(vertx)
  .bridge(new BridgeOptions().setPingTimeout(1))
 );
 client.websocket("/ws-timeout/websocket", ws -> ws.frameHandler(frame -> {
  if (frame.isClose()) {
   assertEquals(1001, frame.closeStatusCode());
   assertEquals("Session expired", frame.closeReason());
   testComplete();
  }
 }));
 await();
}
origin: io.vertx/vertx-lang-groovy

 public static io.vertx.ext.web.handler.sockjs.SockJSHandler bridge(io.vertx.ext.web.handler.sockjs.SockJSHandler j_receiver, java.util.Map<String, Object> bridgeOptions, io.vertx.core.Handler<io.vertx.ext.web.handler.sockjs.BridgeEvent> bridgeEventHandler) {
  io.vertx.core.impl.ConversionHelper.fromObject(j_receiver.bridge(bridgeOptions != null ? new io.vertx.ext.web.handler.sockjs.BridgeOptions(io.vertx.core.impl.ConversionHelper.toJsonObject(bridgeOptions)) : null,
   bridgeEventHandler != null ? event -> bridgeEventHandler.handle(io.vertx.core.impl.ConversionHelper.fromObject(event)) : null));
  return j_receiver;
 }
}
origin: com.progressoft.brix.domino/vertx-domino-event-bus-backend

private BridgeOptions configureBridgeOptions(JsonObject config) {
  BridgeOptions bridgeOptions = new BridgeOptions();
  JsonObject addresses=config.getJsonObject(ADDRESSES);
  JsonArray outbounds=addresses.getJsonArray(OUTBOUND);
  JsonArray inbounds=addresses.getJsonArray(INBOUND);
  outbounds.forEach(o-> addOutboundPermitted(bridgeOptions, (JsonObject) o));
  inbounds.forEach(i-> addInboundPermitted(bridgeOptions, (JsonObject) i));
  return bridgeOptions;
}
origin: com.progressoft.brix.domino/vertx-domino-event-bus-backend

  @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;
  }
}
io.vertx.ext.web.handler.sockjsBridgeOptions<init>

Javadoc

Default constructor

Popular methods of BridgeOptions

  • addOutboundPermitted
  • addInboundPermitted
  • setPingTimeout
  • getInboundPermitteds
  • getMaxAddressLength
  • getMaxHandlersPerSocket
  • getOutboundPermitteds
  • getPingTimeout
  • getReplyTimeout
  • setMaxAddressLength
  • setMaxHandlersPerSocket
  • setOutboundPermitted
  • setMaxHandlersPerSocket,
  • setOutboundPermitted,
  • setReplyTimeout

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • JFrame (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now