public static synchronized void sessionDestroyed(HttpSessionEvent ev) {
    HttpSession httpSession = ev.getSession();
    String id = httpSession.getId();

    synchronized (lookupSessionById) {
      lookupSessionById.remove(id);
    }

    // Forget HTTP-session:
    {
      lookupHttpSessionById.remove(id);
    }
  }
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    String pathInfo = req.getPathInfo();

    HttpSession session = req.getSession();
    if (session == null) {
      resp.setStatus(401);
      return;
    }
    String username = (String) session.getAttribute("username");
    if (username == null) {
      resp.setStatus(401);
      return;
    }

    Map userMap = loadUserSettingsMap(username);
    if (userMap == null) {
      resp.setStatus(401);
      return;
    }
    if (pathInfo.equals("/")) {
      userMap.clear();
    }
    String key = pathInfo.substring(1);
    userMap.remove(key);
    saveUserSettingsMap(username, userMap);
    return;
  }
 @Override
 public void sessionDestroyed(HttpSessionEvent _se) {
   try {
     HttpSession tempSession = sessions.remove(_se.getSession().getId());
   } catch (NullPointerException | UnsupportedOperationException | ClassCastException e) {
   }
   setUsersOnline(getUsersOnline() - 1);
 }
Exemple #4
0
 @Override
 public void removeAttribute(String name) {
   attributes.remove(name);
 }
 public void removeAttribute(String s) {
   attributeMap.remove(s);
 }