myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julián García <jgar...@unionsoluciones.com.co>
Subject Re: PhaseListener Doubts
Date Wed, 14 Dec 2005 18:41:22 GMT
Yes this is what I did first, unsuccessfully....

My faces config has:
	<application>
	<view-handler>
	org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl
	</view-handler>
	
	<message-bundle>
      co.com.unionsoluciones.sofia.cartera.view.bundle.BasicBundleCartera	
	</message-bundle>
	<lifecycle>	 
<phase-listener>co.com.atenaerp.seguridad.acegi.jsf.AccessDecicionManagerPhaseListener</phase-listener>
	</lifecycle>
	</application>

The listener includes this methods:

public void afterPhase(PhaseEvent phase) {
			FacesContext context = phase.getFacesContext();
			String url = context.getViewRoot().getViewId();
			System.out.println(url);
}


public PhaseId getPhaseId() {
		return PhaseId.RENDER_RESPONSE;
}

It just doesn't print anything.




Jeremy Green wrote:
> What happens if you...
> 
> Get rid of your code for registering PhaseListeners and, instead, use:
> 
> <lifecycle>
> <phase-listener>co.com.atenaerp.seguridad.acegi.jsf.AccessDecicionManagerPhaseListener</phase-listener>

> 
> </lifecycle>
> 
> in faces-config.xml. (PhaseListeners are not bound to managed/backing 
> beans, but are bound to the whole JSF application. i.e. any particular 
> PhaseListener that you register via faces-config.xml will be activated 
> for every request made to the application's FacesServlet.)
> 
> Make sure that you're not parsing faces-config.xml twice for the reasons 
> that Bruno Aranda gave in his e-mail.
> 
> Then, make sure that your implementation of PhaseListener has a method 
> exactly like this:
> 
>  public PhaseID getPhaseID() {
>    return PhaseID.RENDER_RESPONSE;
>  }
> 
> This tells MyFaces to only invoke the beforePhase(PhaseEvent) and 
> afterPhase(PhaseEvent) methods in your PhaseListener for the 
> RENDER_RESPONSE phase.
> 
> The code you want to execute after the RENDER_RESPONSE phase would then 
> go in your PhaseListener's afterPhase(PhaseEvent) method.
> 
> Jeremy
> 
> 


Mime
View raw message