Example usage for javax.servlet.http HttpSession invalidate

List of usage examples for javax.servlet.http HttpSession invalidate

Introduction

In this page you can find the example usage for javax.servlet.http HttpSession invalidate.

Prototype

public void invalidate();

Source Link

Document

Invalidates this session then unbinds any objects bound to it.

Usage

From source file:oobbit.controllers.UserController.java

@RequestMapping("/logout")
public String logout(HttpSession session, Model model) {
    session.invalidate(); // Clear session
    return "redirect:/login";
}

From source file:kz.controller.LoginController.java

@RequestMapping(value = "/logout.htm", method = RequestMethod.GET)
public ModelAndView logout(HttpSession session) {
    session.invalidate();
    ModelAndView mv = new ModelAndView("redirect:/index.htm");
    return mv;//from  w  ww .  j  a v a  2  s  .c  om
}

From source file:org.davidmendoza.esu.web.LogoutController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpSession session) {
    log.info("Logging out");
    session.invalidate();

    return "redirect:/";
}

From source file:org.apache.cxf.fediz.service.idp.beans.LogoutAction.java

public void submit(RequestContext requestContext) {
    SecurityContextHolder.clearContext();
    LOG.info("Security context has been cleared.");
    HttpSession session = WebUtils.getHttpSession(requestContext);
    session.invalidate();
    LOG.info("Session " + session.getId() + " has been invalidated.");
}

From source file:com.leapfrog.inventorymanagementsystem.controller.admin.CategoryController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpSession session) {
    session.invalidate();
    return "redirect:/";
}

From source file:com.trailmagic.image.ui.LogoutController.java

@RequestMapping("/logout")
public void handleRequestInternal(HttpServletRequest req, HttpServletResponse res) throws Exception {
    SavedRequest savedRequest = requestCache.getRequest(req, res);

    HttpSession session = req.getSession(false);
    session.invalidate();

    Cookie terminate = new Cookie(TokenBasedRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY, null);
    terminate.setMaxAge(0);//from w w w  . j a  va 2s  . c  o  m
    res.addCookie(terminate);

    if (savedRequest != null) {
        res.sendRedirect(savedRequest.getRedirectUrl());
    } else {
        res.sendRedirect("/photo/albums/");
    }
}

From source file:de.berlios.jhelpdesk.web.AuthenticationController.java

/**
 * Metoda uniewania sesj uytkownika w systemie.
 *
 * @param session sesja uytkownika// w w  w. java 2 s . c o  m
 * @return identyfikator widoku do wywietlenia po wylogowaniu
 */
@RequestMapping(value = "/logout.html")
public String processLogout(HttpSession session) {
    session.invalidate();
    return "redirect:/login.html";
}

From source file:echec.controller.JoueurController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public String finDeSession(Model model, HttpSession s) {
    if (s != null) {
        s.invalidate();
    }/*from  w  w  w  .ja v  a2s  .co  m*/
    model.addAttribute("JoueurAttr", new Joueur());
    return "login.jsp";
}

From source file:br.edu.ifpb.bdnc.db4o.crud.maneger.PessoaEditar.java

public void logout() {
    ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
    HttpServletRequest request = (HttpServletRequest) context.getRequest();
    HttpSession session = request.getSession(true);
    session.invalidate();

}

From source file:cs544.letmegiveexam.controller.LoginController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(Model model, HttpSession session) {
    session.invalidate();
    return "index";
}