goja-web/src/main/java/goja/security/goja/SecurityKit.java
public static <T extends Model> void logout(HttpServletRequest req,
                                                HttpServletResponse response) {
        CookieUser cookie_user = getUserFromCookie(req);
        Requests.deleteCookie(req, response, COOKIE_LOGIN, true);
        // 清理Cache
        if (cookie_user != null) {
            CacheKit.remove(LOGIN_CACHE_SESSION, LOGIN_CACHE_SESSION + cookie_user.getId());
        } else {
            T user = getLoginUser(req);
            if (user != null) {
                CacheKit.remove(LOGIN_CACHE_SESSION,
                        LOGIN_CACHE_SESSION + user.getNumber(StringPool.PK_COLUMN));
            }
        }
        //清除session
        Enumeration<String> em = req.getSession().getAttributeNames();
        while (em.hasMoreElements()) {
            final String key = em.nextElement();
            req.getSession().removeAttribute(key);
        }
        req.getSession().invalidate();
    }
public static <T extends Model> void logout(HttpServletRequest req,
                                                HttpServletResponse response) {
        CookieUser cookie_user = getUserFromCookie(req);
        Requests.deleteCookie(req, response, COOKIE_LOGIN, true);
        // 清理Cache
        if (cookie_user != null) {
            CacheKit.remove(LOGIN_CACHE_SESSION, LOGIN_CACHE_SESSION + cookie_user.getId());
        } else {
            T user = getLoginUser(req);
            if (user != null) {
                CacheKit.remove(LOGIN_CACHE_SESSION,
                        LOGIN_CACHE_SESSION + user.getNumber(StringPool.PK_COLUMN));
            }
        }
        //清除session
        Enumeration<String> em = req.getSession().getAttributeNames();
        while (em.hasMoreElements()) {
            final String key = em.nextElement();
            req.getSession().removeAttribute(key);
        }
        req.getSession().invalidate();
    }
public static < T extends Model > void logout ( HttpServletRequest req , HttpServletResponse response ) { CookieUser cookie_user = getUserFromCookie ( req ) ; Requests . deleteCookie ( req , response , COOKIE_LOGIN , true ) ; // 清理Cache if ( cookie_user != null ) { CacheKit . remove ( LOGIN_CACHE_SESSION , LOGIN_CACHE_SESSION + cookie_user . getId ( ) ) ; } else { T user = getLoginUser ( req ) ; if ( user != null ) { CacheKit . remove ( LOGIN_CACHE_SESSION , LOGIN_CACHE_SESSION + user . getNumber ( StringPool . PK_COLUMN ) ) ; } } //清除session Enumeration < String > em = req . getSession ( ) . getAttributeNames ( ) ; while ( em . hasMoreElements ( ) ) { final String key = em . nextElement ( ) ; req . getSession ( ) . removeAttribute ( key ) ; } req . getSession ( ) . invalidate ( ) ; }
logout

@param req      http request
@param response http response
logout