Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Efetua logout do sistema.
- * @return
- */
- public String logout() {
- log.info( String.format("Efetuado logout do usuario: %s ", this.getUsuarioLogado().getEmail() ));
- ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
- HttpServletRequest req = (HttpServletRequest) ec.getRequest();
- HttpSession session = req.getSession(false);
- try {
- log.info(String.format("Contexto: ", req.getContextPath() ));
- req.logout();
- session.invalidate();
- usuarioLogado = null;
- ec.redirect("/");
- } catch (ServletException ex) {
- log.error( String.format("Erro de Servlet ao efetuar logout. [%s]", ex.getMessage()) );
- } catch (IOException ex) {
- log.error( String.format("Erro de I/O ao efetuar logout. [%s]", ex.getMessage()) );
- } catch (Exception ex){
- log.error( String.format("Erro desconhecido ao efetuar logout. [%s]", ex.getMessage()) );
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement