Ao fazer tentar acessar qualquer página sem fazer login, ao invés de ser redirecionado eu recebo esse erro:
INFORMAÇÕES: Exception when handling error trying to reset the response.
java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:488)
at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:664)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:223)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:182)
at br.com.caelum.livraria.util.AutorizadorListener.afterPhase(AutorizadorListener.java:33)
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/livraria] threw exception [Cannot call sendRedirect() after the response has been committed] with root cause
java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:488)
at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:664)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:223)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:182)
at br.com.caelum.livraria.util.AutorizadorListener.afterPhase(AutorizadorListener.java:33)
Quando eu troco para o redirecionamento no servidor (forward) funciona, porém tem o problema de a url ficar errada.
Link do git: https://github.com/ErivanJunior275/JSF