package de.th.wildau.buchladen;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

/**
 * @author Jan Gabler
 * @author Malte Schwering
 * @version 0.1
 */
public class LogoutManagedBean {
    
    /**
     * Meldet den Benutzer ab.
     */
    public void logout() {
        FacesContext context = FacesContext.getCurrentInstance();
        HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
        try {
            request.logout();
            FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
        } catch (ServletException ex) {
            context.addMessage(null, new FacesMessage("Logout failed."));
        }
    }
    
}

@@ -348,16 +348,60 @@
 zer ab.%0A
+     * @return Zielseite nach der Abmeldung%0A
      */%0A
@@ -415,12 +415,14 @@
 lic 
-void
+String
  log
@@ -848,24 +848,49 @@
 ;%0A        %7D%0A
+        return %22logout%22;%0A
     %7D%0A    %0A%7D

update logoutManagedBean with redirect to logout.xhtml page, #59