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


Java CookieHandler類代碼示例

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


CookieHandler類屬於io.vertx.reactivex.ext.web.handler包,在下文中一共展示了CookieHandler類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mount

import io.vertx.reactivex.ext.web.handler.CookieHandler; //導入依賴的package包/類
@Override
public void mount(final Router router) {
    // 1. Cookie, Body
    router.route().order(Orders.COOKIE)
            .handler(CookieHandler.create());
    router.route().order(Orders.BODY)
            .handler(BodyHandler.create());
    // 2. Session
}
 
開發者ID:silentbalanceyh,項目名稱:vertx-zero,代碼行數:10,代碼來源:RouterAxis.java

示例2: setupWebServer

import io.vertx.reactivex.ext.web.handler.CookieHandler; //導入依賴的package包/類
private Completable setupWebServer() {
  Router router = Router.router(vertx);

  SockJSHandler sockJSHandler = SockJSHandler.create(vertx);
  sockJSHandler.bridge(new BridgeOptions()
    .addOutboundPermitted(new PermittedOptions().setAddressRegex("album\\.\\d+\\.comments\\.new")));
  router.route("/eventbus/*").handler(sockJSHandler);

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

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

  IndexHandler indexHandler = new IndexHandler(dbClient, dbQueries, templateEngine);
  router.get("/").handler(indexHandler);
  router.get("/index.html").handler(indexHandler);

  router.get("/genres/:genreId").handler(new GenreHandler(dbClient, dbQueries, templateEngine));
  router.get("/albums/:albumId").handler(new AlbumHandler(dbClient, dbQueries, templateEngine));
  router.get("/artists/:artistId").handler(new ArtistHandler(dbClient, dbQueries, templateEngine));
  router.get("/covers/:albumId").handler(new CoverHandler(dbClient, dbQueries, WebClient.create(vertx)));

  router.get("/ajax/albums/:albumId/comments")
    .handler(new AjaxAlbumCommentsHandler(albumCommentsBucket.get(), couchbaseQueries, templateEngine));

  router.post("/api/albums/:albumId/comments")
    .consumes("text/plain")
    .handler(new AddAlbumCommentHandler(albumCommentsBucket.get()));

  router.get("/login").handler(new ReturnUrlHandler());
  router.get("/login").handler(rc -> templateEngine.rxRender(rc, "templates/login")
    .subscribe(rc.response()::end, rc::fail));
  router.post("/login").handler(FormLoginHandler.create(authProvider));

  router.get("/add_user").handler(rc -> templateEngine.rxRender(rc, "templates/add_user")
    .subscribe(rc.response()::end, rc::fail));
  router.post("/add_user").handler(new AddUserHandler(dbClient, dbQueries, authProvider));

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

  return vertx.createHttpServer()
    .requestHandler(router::accept)
    .rxListen(8080)
    .toCompletable();
}
 
開發者ID:tsegismont,項目名稱:vertx-musicstore,代碼行數:47,代碼來源:MusicStoreVerticle.java


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