Codota Logo
io.vertx.ext.web.handler
Code IndexAdd Codota to your IDE (free)

How to use io.vertx.ext.web.handler

Best Java code snippets using io.vertx.ext.web.handler (Showing top 20 results out of 423)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • 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()
      .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

router.route().handler(CookieHandler.create());
router.route().handler(BodyHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
router.route().handler(UserSessionHandler.create(authProvider));
router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/loginpage.html"));
router.route("/private/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("private"));
router.route("/loginhandler").handler(FormLoginHandler.create(authProvider));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

@Override
public void start() {
 Router router = Router.router(vertx);
 // Serve the static pages
 router.route().handler(StaticHandler.create());
 vertx.createHttpServer().requestHandler(router).listen(8080);
 System.out.println("Server is started");
}
origin: vert-x3/vertx-examples

router.route().handler(CookieHandler.create());
router.route().handler(BodyHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
router.route().handler(UserSessionHandler.create(authProvider));
BridgeOptions options = new BridgeOptions()
 .addInboundPermitted(new PermittedOptions()
  .setAddress("vtoons.listAlbums"))
 .addInboundPermitted(new PermittedOptions()
  .setAddress("vtoons.login"))
 .addInboundPermitted(new PermittedOptions()
  .setAddress("vtoons.placeOrder")
  .setRequiredAuthority("place_order"))
 .addOutboundPermitted(new PermittedOptions());
router.route("/eventbus/*").handler(SockJSHandler.create(vertx).bridge(options));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

BridgeOptions options = new BridgeOptions().addOutboundPermitted(new PermittedOptions().setAddress("news-feed"));
router.route("/eventbus/*").handler(SockJSHandler.create(vertx).bridge(options, event -> {
 if (event.type() == BridgeEventType.SOCKET_CREATED) {
  System.out.println("A socket was created");
 event.complete(true);
router.route().handler(StaticHandler.create());
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

@Validate
public void start() throws Exception {
 setUpInitialData();
 TcclSwitch.executeWithTCCLSwitch(() -> {
  Router router = Router.router(vertx);
  router.route().handler(BodyHandler.create());
  router.get("/products/:productID").handler(this::handleGetProduct);
  router.put("/products/:productID").handler(this::handleAddProduct);
  router.get("/products").handler(this::handleListProducts);
  router.get("/assets/*").handler(StaticHandler.create("assets", this.getClass().getClassLoader()));
  LOGGER.info("Creating HTTP server for vert.x web application");
  HttpServer server = vertx.createHttpServer();
  server.requestHandler(router).listen(8081);
 });
}
origin: vert-x3/vertx-examples

@Override
public void start() {
 setUpInitialData();
 Router router = Router.router(vertx);
 router.route().handler(BodyHandler.create());
 router.get("/products/:productID").handler(this::handleGetProduct);
 router.put("/products/:productID").handler(this::handleAddProduct);
 router.get("/products").handler(this::handleListProducts);
 vertx.createHttpServer().requestHandler(router).listen(8080);
}
origin: vert-x3/vertx-examples

allowedMethods.add(HttpMethod.PUT);
router.route().handler(CorsHandler.create("*").allowedHeaders(allowedHeaders).allowedMethods(allowedMethods));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

router.route().handler(CookieHandler.create());
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

router.route().handler(CookieHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
router.route().handler(UserSessionHandler.create(authProvider));
 OAuth2AuthHandler.create(authProvider)
  .setupCallback(router.route("/callback"))
  .addAuthority("user:email")
);
origin: vert-x3/vertx-examples

@Override
public void start() {
 Router router = Router.router(vertx);
 // Serve the dynamic pages
 router.route("/dynamic/*")
  .handler(ctx -> {
   // put the context into the template render context
   ctx.put("context", ctx);
   ctx.next();
  })
  .handler(TemplateHandler.create(MVELTemplateEngine.create(vertx)));
 // Serve the static pages
 router.route().handler(StaticHandler.create());
 vertx.createHttpServer().requestHandler(router).listen(8080);
}
origin: vert-x3/vertx-examples

router.route("/api/protected").handler(JWTAuthHandler.create(jwt));
router.route("/api/protected/defcon1").handler(JWTAuthHandler.create(jwt).addAuthority("defcon1"));
router.route("/api/protected/defcon2").handler(JWTAuthHandler.create(jwt).addAuthority("defcon2"));
router.route("/api/protected/defcon3").handler(JWTAuthHandler.create(jwt).addAuthority("defcon3"));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

router.route("/api/*").handler(JWTAuthHandler.create(jwt, "/api/newToken"));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {

  Router router = Router.router(vertx);

  router.route().handler(CookieHandler.create());
  router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));

  router.route().handler(routingContext -> {

   Session session = routingContext.session();

   Integer cnt = session.get("hitcount");
   cnt = (cnt == null ? 0 : cnt) + 1;

   session.put("hitcount", cnt);

   routingContext.response().putHeader("content-type", "text/html")
                .end("<html><body><h1>Hitcount: " + cnt + "</h1></body></html>");
  });

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

 @Override
 public void start() throws Exception {

  final Router router = Router.router(vertx);

  // Populate context with data
  router.route().handler(ctx -> {
   ctx.put("title", "Vert.x Web Example Using Rocker");
   ctx.put("name", "Rocker");
   ctx.next();
  });

  // Render a custom template.
  // Note: you need a compile-time generator for Rocker to work properly
  // See the pom.xml for an example
  router.route().handler(TemplateHandler.create(RockerTemplateEngine.create()));

  vertx.createHttpServer().requestHandler(router).listen(8080);
 }
}
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

router.route().handler(CookieHandler.create());
router.route().handler(BodyHandler.create());
router.route().handler(SessionHandler.create(LocalSessionStore.create(vertx)));
router.route().handler(UserSessionHandler.create(authProvider));
router.route("/private/*").handler(RedirectAuthHandler.create(authProvider, "/loginpage.html"));
router.route("/private/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("private"));
router.route("/loginhandler").handler(FormLoginHandler.create(authProvider));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

router.route().handler(BodyHandler.create());
origin: vert-x3/vertx-examples

 @Override
 public void start() throws Exception {
  Router router = Router.router(vertx);

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

  vertx.createHttpServer().requestHandler(router).listen(configuration.httpPort());
 }
}
io.vertx.ext.web.handler

Most used classes

  • BodyHandler
    A handler which gathers the entire request body and sets it on the RoutingContext. It also handles H
  • StaticHandler
    A handler for serving static resources from the file system or classpath.
  • BridgeOptions
    Options for configuring the event bus bridge.
  • SockJSHandler
    A handler that allows you to handle SockJS connections from clients. We currently support version 0.
  • CookieHandler
    A handler which decodes cookies from the request, makes them available in the RoutingContextand writ
  • CorsHandler,
  • BasicAuthHandler,
  • AuthHandler,
  • BridgeEvent,
  • SessionHandler,
  • ChainAuthHandler,
  • OAuth2AuthHandler,
  • TemplateHandler,
  • UserSessionHandler,
  • BodyHandlerImpl,
  • HttpStatusException,
  • SockJSHandlerOptions,
  • SockJSSocket,
  • JWTAuthHandler
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