super.processRender(context);
}
public static class LogoutActionListener extends EventListener<UIComponent> {
public void execute(Event<UIComponent> event) throws Exception {
StandaloneAppRequestContext context = (StandaloneAppRequestContext) event.getRequestContext();
HttpServletRequest req = context.getRequest();
// Delete the token from JCR
String token = getTokenCookie(req);
if (token != null) {
AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
}
token = LoginServlet.getOauthRememberMeTokenCookie(req);
if (token != null) {
AbstractTokenService tokenService = AbstractTokenService.getInstance(CookieTokenService.class);
tokenService.deleteToken(token);
}
LogoutControl.wantLogout();
Cookie cookie = new Cookie(LoginServlet.COOKIE_NAME, "");
cookie.setPath(req.getContextPath());
cookie.setMaxAge(0);
context.getResponse().addCookie(cookie);
Cookie oauthCookie = new Cookie(LoginServlet.OAUTH_COOKIE_NAME, "");
oauthCookie.setPath(req.getContextPath());
oauthCookie.setMaxAge(0);
context.getResponse().addCookie(oauthCookie);
context.sendRedirect(req.getRequestURI());
}