本文整理汇总了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();
}