How to integrate custom PhaseListener in faces-config.xml?
I want to implement a custom PhaseListener in my faces-config.xml like it is [suggested][1] at stack overflow. So this is my faces-config.xml:
<lifecycle>
<phase-listener>org.apache.myfaces.extensions.validator.core.startup.ExtValStartupListener</phase-listener>
<phase-listener>org.apache.myfaces.extensions.validator.beanval.startup.JSF2AwareBeanValidationStartupListener</phase-listener>
<phase-listener>org.apache.myfaces.extensions.validator.beanval.startup.BeanValidationStartupListener</phase-listener>
<phase-listener>de.azt.MyPhaseListener</phase-listener>
</lifecycle>
And this is MyPhaseListener-Dummy:
public class MyPhaseListener implements PhaseListener {
@Override
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
@Override
public void beforePhase(PhaseEvent event) {
// Do your job here which should run right before the RENDER_RESPONSE.
}
@Override
public void afterPhase(PhaseEvent event) {
// Do your job here which should run right after the RENDER_RESPONSE.
}
}
But this approach leads the application server to crash:
HTTP Status 500 - serialFactory
type Exception report
message serialFactory
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: serialFactory
javax.faces.webapp.FacesServlet.service(FacesServlet.java:229)
org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
ch.ivyteam.ivy.dialog.execution.jsf.controller.rest.IvyRestServiceFilter.doFilter(IvyRestServiceFilter.java:54)
ch.ivyteam.ivy.dialog.execution.jsf.controller.IvyFacesInstanceFilter.filterAsSystem(IvyFacesInstanceFilter.java:104)
ch.ivyteam.ivy.dialog.execution.jsf.controller.IvyFacesInstanceFilter.access$0(IvyFacesInstanceFilter.java:79)
ch.ivyteam.ivy.dialog.execution.jsf.controller.IvyFacesInstanceFilter$1.call(IvyFacesInstanceFilter.java:55)
ch.ivyteam.ivy.dialog.execution.jsf.controller.IvyFacesInstanceFilter$1.call(IvyFacesInstanceFilter.java:1)
ch.ivyteam.ivy.security.internal.SecurityManager.executeAsSystem(SecurityManager.java:1425)
So how is it possible to implement a custom PhaseListener?
[1]: http://stackoverflow.com/questions/8388854/how-to-implement-a-phaselistener-which-runs-at-end-of-lifecycle