Codota Logo
StaticHandler.create
Code IndexAdd Codota to your IDE (free)

How to use
create
method
in
io.vertx.ext.web.handler.StaticHandler

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

  • Common ways to obtain StaticHandler
private void myMethod () {
StaticHandler s =
  • Codota IconString str;StaticHandler.create(str)
  • Smart code suggestions by Codota
}
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

 @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());
 }
}
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

@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() {
 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

 @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

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

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

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

router.route().handler(StaticHandler.create());
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(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

router.route().handler(StaticHandler.create());
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(StaticHandler.create());
origin: vert-x3/vertx-examples

router.route("/private/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("private"));
router.route().handler(StaticHandler.create());
origin: vert-x3/vertx-examples

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

router.route("/private/*").handler(StaticHandler.create().setCachingEnabled(false).setWebRoot("private"));
router.route().handler(StaticHandler.create());
io.vertx.ext.web.handlerStaticHandlercreate

Javadoc

Create a handler using defaults

Popular methods of StaticHandler

  • setCachingEnabled
    Set whether cache header handling is enabled
  • setDirectoryListing
    Set whether directory listing is enabled
  • setIndexPage
    Set the index page
  • setWebRoot
    Set the web root
  • setAllowRootFileSystemAccess
    Enable/Disable access to the root of the filesystem
  • setHttp2PushMapping
    Set the file mapping for http2push and link preload
  • setAlwaysAsyncFS
    Set whether async filesystem access should always be used
  • setCacheEntryTimeout
    Set the server cache entry timeout when caching is enabled
  • setDefaultContentEncoding
    Set the default content encoding for text related files. This allows overriding the system settings
  • setDirectoryTemplate
    Set the directory template to be used when directory listing
  • setEnableRangeSupport
    Set whether range requests (resumable downloads; media streaming) should be enabled.
  • setFilesReadOnly
    Set whether files are read-only and will never change
  • setEnableRangeSupport,
  • setFilesReadOnly,
  • setIncludeHidden,
  • setMaxAgeSeconds,
  • setMaxAvgServeTimeNs,
  • skipCompressionForMediaTypes,
  • skipCompressionForSuffixes,
  • handle,
  • setEnableFSTuning

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • getApplicationContext (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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