本文整理匯總了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
}
示例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();
}