Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-Alpha2
-
Fix Version/s: 2.0-Alpha3, 2.0.0
-
Component/s: Framework
-
Labels:None
-
Environment:JBoss 6, Windows XP
Description
If I try and forward to a page using the XML navigation or using the handleNavigation method I get the following error DOM is null during applyBrowserChanges and Old DOM is null during domDiff calculation.
Below is a copy of my code to check to see if somebody is logged in before accessing any web pages, if they are not display the login page.
package com.abmsoftware.phaseListener;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.servlet.http.HttpSession;
import com.abmsoftware.backingbean.global.GlobalSettings;
/**
* Class checks that the user is logged in.
* @author fryers
*/
public class AccessControlPhaseListener implements PhaseListener
{
/**
* Called after the phase has completed.
* @param event Phase event triggered.
*/
public void afterPhase(PhaseEvent event)
{
FacesContext context = event.getFacesContext();
HttpSession session =
(HttpSession)context.getExternalContext().getSession(true);
GlobalSettings globalSettings =
(GlobalSettings)session.getAttribute("globalSettings");
if((globalSettings == null || !globalSettings.isLoggedIn()) &&
!"/login.jsf".equals(context.getViewRoot().getViewId()))
{
context.getApplication().getNavigationHandler().handleNavigation(
context, null, "login");
}
}
/**
* Called before the phase has started.
* @param event Phase event triggered.
*/
public void beforePhase(PhaseEvent event)
{
}
public PhaseId getPhaseId()
{
return PhaseId.RESTORE_VIEW;
}
}
Below is a copy of my code to check to see if somebody is logged in before accessing any web pages, if they are not display the login page.
package com.abmsoftware.phaseListener;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.servlet.http.HttpSession;
import com.abmsoftware.backingbean.global.GlobalSettings;
/**
* Class checks that the user is logged in.
* @author fryers
*/
public class AccessControlPhaseListener implements PhaseListener
{
/**
* Called after the phase has completed.
* @param event Phase event triggered.
*/
public void afterPhase(PhaseEvent event)
{
FacesContext context = event.getFacesContext();
HttpSession session =
(HttpSession)context.getExternalContext().getSession(true);
GlobalSettings globalSettings =
(GlobalSettings)session.getAttribute("globalSettings");
if((globalSettings == null || !globalSettings.isLoggedIn()) &&
!"/login.jsf".equals(context.getViewRoot().getViewId()))
{
context.getApplication().getNavigationHandler().handleNavigation(
context, null, "login");
}
}
/**
* Called before the phase has started.
* @param event Phase event triggered.
*/
public void beforePhase(PhaseEvent event)
{
}
public PhaseId getPhaseId()
{
return PhaseId.RESTORE_VIEW;
}
}
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Logic around navigation has been improved for the upcoming Alpha 3 release. The logging about the null DOM has been removed/toned down because, during navigation, it's perfectly valid for the old DOM reference (which is stored as a view attribute) to be lost when the view map goes away.