/** * Convenience method for clearing a cookie. * * @param cookie * The cookie to set * @see WebResponse#addCookie(Cookie) */ public void clearCookie(final Cookie cookie) { if (httpServletResponse != null) { cookie.setMaxAge(0); cookie.setValue(null); addCookie(cookie); } }
/** * Convenience method for clearing a cookie. * * @param cookie * The cookie to set * @see WebResponse#addCookie(Cookie) */ public void clearCookie(final Cookie cookie) { if (httpServletResponse != null) { cookie.setMaxAge(0); cookie.setValue(null); addCookie(cookie); } }
/** * Constructor. The page will redirect to the given url after waiting for the given number of * seconds. * * @param url * The url to redirect to * @param waitBeforeRedirectInSeconds * The number of seconds the browser should wait before redirecting */ private void doLogoutAndAddRedirect(final CharSequence url, final int waitBeforeRedirectInSeconds) { setStatelessHint(true); // this should remove the cookie... final Subject subject = SecurityUtils.getSubject(); LOG.info("logout: " + subject); subject.logout(); final WebMarkupContainer redirect = new WebMarkupContainer("redirect"); final String content = waitBeforeRedirectInSeconds + ";URL=" + url; redirect.add(new AttributeModifier("content", new Model<String>(content))); add(redirect); // invalidate the session Session.get().invalidateNow(); // invalidate the wicket session // HYMMMM final Cookie c = new Cookie("rememberMe", "xxx"); c.setMaxAge(0); ((WebResponse)RequestCycle.get().getResponse()).addCookie(c); }
/** * Constructor. The page will redirect to the given url after waiting for the given number of * seconds. * * @param url * The url to redirect to * @param waitBeforeRedirectInSeconds * The number of seconds the browser should wait before redirecting */ private void doLogoutAndAddRedirect(final CharSequence url, final int waitBeforeRedirectInSeconds) { this.setStatelessHint( true ); // this should remove the cookie... SecurityUtils.getSubject().logout(); final WebMarkupContainer redirect = new WebMarkupContainer("redirect"); final String content = waitBeforeRedirectInSeconds + ";URL=" + url; redirect.add(new AttributeModifier("content", new Model<String>(content))); add(redirect); // invalidate the session Session.get().invalidateNow(); // invalidate the wicket session // HYMMMM Cookie c = new Cookie( "rememberMe", "xxx" ); c.setMaxAge(0); ((WebResponse)RequestCycle.get().getResponse()).addCookie( c ); }
cookie.setSecure(settings.getSecure()); getWebResponse().addCookie(cookie);
cookie.setSecure(getSettings().getSecure()); getWebResponse().addCookie(cookie);