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:br.edu.ifpb.bdnc.db4o.crud.maneger.PessoaGerenciador.java

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

}

From source file:com.MyHistory.Controller.UsuarioController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public ModelAndView cerrarSesion(HttpServletRequest pRequest) {
    HttpSession sesion = pRequest.getSession();
    sesion.invalidate();
    ModelAndView model = new ModelAndView();
    model.setViewName("redirect:/login.htm");
    return model;
}

From source file:mx.com.quadrum.contratos.controller.HomeController.java

@RequestMapping(value = "cerrarSesion")
public String cerrarSession(HttpSession session) {
    session.invalidate();
    return "templates/index";
}

From source file:mx.com.quadrum.contratos.controller.HomeController.java

@RequestMapping(value = "cerrarSesionCliente")
public String cerrarSessionCliente(HttpSession session) {
    session.invalidate();
    return "cliente/index";
}

From source file:nl.conspect.legacy.user.web.LogoutController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    HttpSession session = request.getSession(false);
    if (session != null) {
        session.invalidate();
    }//from w ww. j  a v a  2 s  . c o m
    return new ModelAndView("redirect:/app/index", Collections.singletonMap("msg", "Logout successful."));
}

From source file:edu.umn.msi.tropix.webgui.server.security.impl.SpringAdaptingLoginHandlerImpl.java

public void logout() {
    //Code roughly resembles SpringSecurity's SecurityContextLogoutHandler class
    final HttpSession session = httpSessionSupplier.get();
    session.invalidate();
    SecurityContextHolder.clearContext();
    LOG.debug("Cleared context and invalidated HttpSession.");
}

From source file:net.longfalcon.web.LogoutController.java

@RequestMapping("/logout")
public String logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
        HttpSession httpSession, Model model) {
    try {//from w  w  w.  j  a  va 2 s. c  o m
        httpSession.invalidate();
        Cookie uidCookie = new Cookie("uid", "");
        uidCookie.setMaxAge(-1);
        Cookie idhCookie = new Cookie("idh", "");
        idhCookie.setMaxAge(-1);
        httpServletResponse.addCookie(uidCookie);
        httpServletResponse.addCookie(idhCookie);
    } catch (Exception e) {
        _log.error(e, e);
    }
    model.asMap().clear();
    return "redirect:/";
}

From source file:com.tongji.collaborationteam.pagecontrollers.IndexController.java

@RequestMapping(value = "/index", params = "log_out")
public ModelAndView log_out(HttpSession session) {
    //  session.removeAttribute("session_user");
    session.invalidate();
    ModelAndView mv = new ModelAndView("redirect:index", "myinfo", new MyInfo());
    mv.addObject("login_info", new MyInfo());
    return mv;// w w  w. j  a v a  2s.  c o  m

}

From source file:br.com.painel.controller.LoginController.java

@RequestMapping("logout")
public String logout(HttpSession session) {
    session.invalidate();
    return "redirect:index";
}

From source file:br.com.edo.atmlist.controller.ATMController.java

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