ctx.addCookie(Cookie.cookie("visits", "" + visits));
@Override public RoutingContext addCookie(Cookie cookie) { inner.addCookie(cookie); return this; }
@Override public RoutingContext addCookie(Cookie cookie) { return decoratedContext.addCookie(cookie); }
private void createNewSession(RoutingContext context) { Session session = sessionStore.createSession(sessionTimeout, minLength); context.setSession(session); Cookie cookie = Cookie.cookie(sessionCookieName, session.value()); cookie.setPath(sessionCookiePath); cookie.setSecure(sessionCookieSecure); cookie.setHttpOnly(sessionCookieHttpOnly); // Don't set max age - it's a session cookie context.addCookie(cookie); addStoreSessionHandler(context); } }
@Override public RoutingContext addCookie(Cookie cookie) { inner.addCookie(cookie); return this; }
@Override public RoutingContext addCookie(Cookie cookie) { this.inner.addCookie(cookie); return this; }
@Override public void addCookie(Cookie cookie) { rc.addCookie(cookie); }
@Override public RoutingContext addCookie(Cookie cookie) { return delegate.addCookie(cookie); }
@Override public RoutingContext addCookie(Cookie cookie) { return decoratedContext.addCookie(cookie); }
@Override public RoutingContext addCookie(Cookie cookie) { return rc.addCookie(cookie); }
@Override public void handle(RoutingContext context) { String cookieHeader = context.request().headers().get(COOKIE); if (cookieHeader != null) { Set<io.netty.handler.codec.http.cookie.Cookie> nettyCookies = ServerCookieDecoder.STRICT.decode(cookieHeader); for (io.netty.handler.codec.http.cookie.Cookie cookie : nettyCookies) { Cookie ourCookie = new CookieImpl(cookie); context.addCookie(ourCookie); } } context.addHeadersEndHandler(v -> { // save the cookies Set<Cookie> cookies = context.cookies(); for (Cookie cookie: cookies) { if (cookie.isChanged()) { context.response().headers().add(SET_COOKIE, cookie.encode()); } } }); context.next(); }
/** * Add a cookie. This will be sent back to the client in the response. The context must have first been routed * to a {@link io.vertx.rxjava.ext.web.handler.CookieHandler} for this to work. * @param cookie the cookie * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.RoutingContext addCookie(io.vertx.rxjava.ext.web.Cookie cookie) { delegate.addCookie(cookie.getDelegate()); return this; }
/** * Add a cookie. This will be sent back to the client in the response. The context must have first been routed * to a {@link io.vertx.rxjava.ext.web.handler.CookieHandler} for this to work. * @param cookie the cookie * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.ext.web.RoutingContext addCookie(io.vertx.rxjava.ext.web.Cookie cookie) { delegate.addCookie(cookie.getDelegate()); return this; }
ctx.addCookie(Cookie.cookie(cookieName, token).setPath(cookiePath)); ctx.next(); break;
assertEquals("blibble", rc.getCookie("wibble").getValue()); assertNotNull(rc.getCookie("plop")); rc.addCookie(Cookie.cookie("fleeb", "floob")); assertEquals(4, rc.cookieCount()); assertNull(rc.removeCookie("blarb"));
@Override public void addResponseCookie(Cookie cookie) { routingContext.addCookie(io.vertx.ext.web.Cookie.cookie(cookie.getName(), cookie.getValue())); }
@Override public void logout() { Session session = rc.session(); if (session != null) { session.destroy(); } rc.addCookie(Cookie.cookie(MeshJWTAuthProvider.TOKEN_COOKIE_KEY, "deleted").setMaxAge(0).setPath("/")); rc.clearUser(); }
private void createNewSession(RoutingContext context) { Session session = sessionStore.createSession(sessionTimeout, minLength); context.setSession(session); Cookie cookie = Cookie.cookie(sessionCookieName, session.value()); cookie.setPath(sessionCookiePath); cookie.setSecure(sessionCookieSecure); cookie.setHttpOnly(sessionCookieHttpOnly); // Don't set max age - it's a session cookie context.addCookie(cookie); addStoreSessionHandler(context); } }
private void createNewSession(RoutingContext context) { Session session = sessionStore.createSession(sessionTimeout, minLength); context.setSession(session); Cookie cookie = Cookie.cookie(sessionCookieName, session.id()); cookie.setPath(sessionCookiePath); cookie.setSecure(sessionCookieSecure); cookie.setHttpOnly(sessionCookieHttpOnly); // Don't set max age - it's a session cookie context.addCookie(cookie); addStoreSessionHandler(context); }
private void createNewSession(RoutingContext context) { Session session = sessionStore.createSession(sessionTimeout, minLength); context.setSession(session); Cookie cookie = Cookie.cookie(sessionCookieName, session.id()); cookie.setPath(sessionCookiePath); cookie.setSecure(sessionCookieSecure); cookie.setHttpOnly(sessionCookieHttpOnly); // Don't set max age - it's a session cookie context.addCookie(cookie); addStoreSessionHandler(context); }