public void logout() throws ServletException, IOException { ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); ((HttpServletRequest) ec.getRequest()).logout(); ec.invalidateSession(); ec.redirect("http://example.com/anothercontext/logout"); }
/** * @see Faces#invalidateSession() */ public static void invalidateSession(FacesContext context) { context.getExternalContext().invalidateSession(); }
/** * @see Faces#invalidateSession() */ public static void invalidateSession(FacesContext context) { context.getExternalContext().invalidateSession(); }
/** * @since 2.0 */ public void invalidateSession() { ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get(); if (ctx == null) { throw new UnsupportedOperationException(); } ctx.invalidateSession(); }
public String logout() { String identifier = userId; // invalidate the session LOGGER.debug("invalidating session for '{}'", identifier); FacesContext.getCurrentInstance().getExternalContext() .invalidateSession(); LOGGER.info("logout successful for '{}'", identifier); return LOGOUT_PAGE_REDIRECT; }
public void logout() throws IOException { ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); ec.invalidateSession(); ec.redirect("../login.html"); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
@Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
/** * <p>The default behavior of this method is to * call {@link ExternalContext#invalidateSession} * on the wrapped {@link ExternalContext} object.</p> * * @see javax.faces.context.ExternalContext#invalidateSession() */ @Override public void invalidateSession() { getWrapped().invalidateSession(); }
public String logout() throws IOException { ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); externalContext.invalidateSession(); return externalContext.getRequestContextPath() + "/secure/login.xhtml";
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); externalContext.invalidateSession(); externalContext.getSessionMap().put("user", user);
public boolean isSessionAwareResourceRequest(FacesContext context) { if (!EnvUtils.isStrictSessionTimeout(context)) { return handler.isResourceRequest(context); } HttpSession httpSession = EnvUtils.getSafeSession(context); Long lastAccessTime = (Long) httpSession.getAttribute(SessionTimeoutMonitor.class.getName()); boolean isPushRelatedRequest = EnvUtils.isPushRequest(context); if (lastAccessTime == null || !isPushRelatedRequest) { lastAccessTime = System.currentTimeMillis(); httpSession.setAttribute(SessionTimeoutMonitor.class.getName(), System.currentTimeMillis()); } int maxInactiveInterval = httpSession.getMaxInactiveInterval(); if (maxInactiveInterval > 0 && (System.currentTimeMillis() - lastAccessTime) / 1000 > maxInactiveInterval) { Log.fine("invalidating session enforcing strictSessionTimeout"); httpSession.removeAttribute(SessionTimeoutMonitor.class.getName()); context.getExternalContext().invalidateSession(); } return handler.isResourceRequest(context); }
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); externalContext.invalidateSession(); LoginController loginController = new LoginController(); loginController.setUser(user); externalContext.getSessionMap().put("loginController", loginController);