Olá Pessoal!
Eu estou tentando somente imprimir um log na classe LogPhaseListener, porém não aparece nada no console.
Seguem os códigos.
LogPhaseListener.java
package com.project.util;
import javax.faces.application.NavigationHandler;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import com.project.bean.PagePathsBean;
import com.project.model.User;
public class LogPhaseListener implements PhaseListener {
private static final long serialVersionUID = 1L;
@Override
public void afterPhase(PhaseEvent arg0) {
System.out.println("afterPhase LogPhaseListener");
}
@Override
public void beforePhase(PhaseEvent event) {
System.out.println("beforePhase LogPhaseListener");
}
@Override
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
}
}
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<message-bundle>com.project.i18n.validationMessages</message-bundle>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>pt_BR</supported-locale>
</locale-config>
<resource-bundle>
<base-name>com.project.i18n.messages</base-name>
<var>msg</var>
</resource-bundle>
</application>
<lifecycle>
<phase-listener>com.project.util.I18nLocale</phase-listener>
<phase-listener>com.project.util.LogPhaseListener</phase-listener>
</lifecycle>
<component>
<component-type>org.primefaces.component.OlymposMenu</component-type>
<component-class>org.primefaces.olympos.component.menu.OlymposMenu</component-class>
</component>
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>org.primefaces.component.OlymposMenuRenderer</renderer-type>
<renderer-class>org.primefaces.olympos.component.menu.OlymposMenuRenderer</renderer-class>
</renderer>
</render-kit>
<converter>
<converter-for-class>java.lang.Enum</converter-for-class>
<converter-class>javax.faces.convert.EnumConverter</converter-class>
</converter>
</faces-config>
Eu estou utilizando autenticação e sutorização do wildfly (JAAS), não sei se interfere em algo.
segue o web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Basic Project JSF, Maven, jUnit and Wildfly</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- <listener> -->
<!-- <listener-class>com.sun.faces.config.ConfigureListener</listener-class> -->
<!-- </listener> -->
<filter>
<filter-name>Character Encoding Filter</filter-name>
<filter-class>org.primefaces.olympos.filter.CharacterEncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Character Encoding Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter>
<filter-name>RegisterNavigationFilter</filter-name>
<filter-class>com.project.filters.RegisterNavigationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RegisterNavigationFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>olympos</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/primefaces-olympos.taglib.xml</param-value>
</context-param>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/font-sfnt</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff2</extension>
<mime-type>application/font-woff2</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eot?#iefix</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exosemibold</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exobolditalic</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exomedium</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#exoregular</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg#fontawesomeregular</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>/all-users/empty.xhtml</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/public/404.xhtml</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/public/access-denied.xhtml</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/public/error.xhtml</location>
</error-page>
<!--Defining type of authenitcation mechanism-->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>basicProjectDB</realm-name>
<form-login-config>
<form-login-page>/public/login.xhtml</form-login-page>
<form-error-page>/public/error.xhtml</form-error-page>
</form-login-config>
</login-config>
<!--Defining type of authenitcation mechanism-->
<!--Denining security role-->
<security-role>
<role-name>ADMINISTRATOR</role-name>
</security-role>
<security-role>
<role-name>USER</role-name>
</security-role>
<!--Denining security role-->
<!--Defining security constraint for type of roles available-->
<security-constraint>
<web-resource-collection>
<web-resource-name>administrator</web-resource-name>
<url-pattern>/administrator/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ADMINISTRATOR</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>all-users</web-resource-name>
<url-pattern>/all-users/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ADMINISTRATOR</role-name>
<role-name>USER</role-name>
</auth-constraint>
</security-constraint>
<!--Defining security constraint for type of roles available-->
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>false</param-value>
</context-param>
</web-app>
Alguma idéia?
Obrigado Helio