當前位置: 首頁>>代碼示例>>Java>>正文


Java StaticHandler.setWebRoot方法代碼示例

本文整理匯總了Java中io.vertx.ext.web.handler.StaticHandler.setWebRoot方法的典型用法代碼示例。如果您正苦於以下問題:Java StaticHandler.setWebRoot方法的具體用法?Java StaticHandler.setWebRoot怎麽用?Java StaticHandler.setWebRoot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.vertx.ext.web.handler.StaticHandler的用法示例。


在下文中一共展示了StaticHandler.setWebRoot方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initStaticResourceHandler

import io.vertx.ext.web.handler.StaticHandler; //導入方法依賴的package包/類
private void initStaticResourceHandler() {
    StaticHandler staticHandler = StaticHandler.create();
    if (nonNull(System.getProperty("domino.webroot.location"))) {
        staticHandler.setAllowRootFileSystemAccess(true);
        staticHandler.setWebRoot(systemWebRoot());
    } else {
        staticHandler.setWebRoot(webroot);
    }

    router.route("/").order(Integer.MAX_VALUE - 2)
            .handler(this::serveIndexPage);

    router.route("/static/*").order(Integer.MAX_VALUE - 1)
            .handler(staticHandler)
            .failureHandler(this::serveResource);

    router.route("/*").order(Integer.MAX_VALUE)
            .handler(this::serveResource);

}
 
開發者ID:GwtDomino,項目名稱:domino,代碼行數:21,代碼來源:DominoLoader.java

示例2: registerWithRouter

import io.vertx.ext.web.handler.StaticHandler; //導入方法依賴的package包/類
@Override
public void registerWithRouter(Router router) {
  StaticHandler staticHandler = StaticHandler.create();
  staticHandler.setWebRoot("META-INF/resources/webjars");
  router.route("/static/*").handler(staticHandler);

  // Disable caching so you don't need to clear cache everytime yaml changes.
  StaticHandler swaggerHandler =
      StaticHandler.create().setWebRoot("webroot/swagger").setCachingEnabled(false);
  router.route("/doc/*").handler(swaggerHandler);
}
 
開發者ID:datastax,項目名稱:simulacron,代碼行數:12,代碼來源:SwaggerUI.java

示例3: UdidbServer

import io.vertx.ext.web.handler.StaticHandler; //導入方法依賴的package包/類
public UdidbServer(String[] args)
{
    // TODO process args to configure the server

    initializeLogging();

    String uiPath = System.getProperty("udidb.ui.path", "");
    boolean cors = Boolean.getBoolean("udidb.cors");

    Injector injector = Guice.createInjector(new ServerModule());

    Vertx vertx = injector.getInstance(Vertx.class);

    this.httpServer = vertx.createHttpServer(new HttpServerOptions().setWebsocketSubProtocols("wamp.2.json"));

    // WebSocket events
    this.httpServer.websocketHandler(websocket -> {
        if (!websocket.path().equals("/events")) {
            websocket.reject();
        }

        injector.getInstance(EventsSocket.class).setServerWebSocket(websocket);
    });

    Router router = Router.router(vertx);

    // static content for the UI
    StaticHandler staticHandler = StaticHandler.create();
    if (uiPath != null) {
        staticHandler.setAllowRootFileSystemAccess(true);
        staticHandler.setWebRoot(uiPath);
    }else{
        staticHandler.setWebRoot("webui");
    }
    router.route("/webui/*").handler(staticHandler);

    // API resources
    if (cors) {
        router.route().handler(CorsHandler.create("*").allowedHeader("Content-Type"));
    }

    router.route().handler(BodyHandler.create());

    DebuggeeContexts debuggeeContexts = injector.getInstance(DebuggeeContexts.class);

    router.get("/debuggeeContexts")
          .blockingHandler(noParamHandler(debuggeeContexts::getAll));
    router.post("/debuggeeContexts")
          .blockingHandler(bodyHandler(debuggeeContexts::create));
    router.options("/debuggeeContexts")
          .blockingHandler(ok());
    router.get("/debuggeeContexts/operations")
          .blockingHandler(noParamHandler(debuggeeContexts::getOperationDescriptions));
    router.post("/debuggeeContexts/globalOperation")
          .blockingHandler(bodyHandler(debuggeeContexts::createGlobalOperation));
    router.options("/debuggeeContexts/globalOperation")
          .blockingHandler(ok());
    router.get("/debuggeeContexts/:id")
          .blockingHandler(pathParamHandler("id", debuggeeContexts::get));
    router.get("/debuggeeContexts/:id/process")
          .blockingHandler(pathParamHandler("id", debuggeeContexts::getProcess));
    router.get("/debuggeeContexts/:id/process/threads")
          .blockingHandler(pathParamHandler("id", debuggeeContexts::getThreads));
    router.get("/debuggeeContexts/:id/process/threads/:threadId")
          .blockingHandler(varPathParamHandler(debuggeeContexts::getThread, "id", "threadId"));
    router.post("/debuggeeContexts/:id/process/operation")
          .blockingHandler(bodyHandler("id", debuggeeContexts::createOperation));
    router.options("/debuggeeContexts/:id/process/operation")
          .blockingHandler(ok());
    router.get("/debuggeeContexts/:id/process/operation")
          .blockingHandler(pathParamHandler("id", debuggeeContexts::getOperation));
    router.get("/debuggeeContexts/:id/process/operations")
          .blockingHandler(pathParamHandler("id", debuggeeContexts::getOperationDescriptions));

    httpServer.requestHandler(router::accept);
}
 
開發者ID:udidb,項目名稱:udidb,代碼行數:77,代碼來源:UdidbServer.java


注:本文中的io.vertx.ext.web.handler.StaticHandler.setWebRoot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。