Why is NavigationHandler.handleNavigation() not forwarding to view ID?
- by Erik Hermansen
Inside of a phase listener class that runs during the "RESTORE_VIEW" phase, I have some code like this:
public void afterPhase(PhaseEvent event) {
FacesContext fc = event.getFacesContext();
NavigationHandler nh = fc.getApplication().getNavigationHandler();
nh.handleNavigation(fc, null, "/a/specific/path/to/a/resource.jspx");
}
Navigation to the new URL doesn't work here. The request made will just receive a response from the original JSPX that was navigated to.
Code like this works fine:
public void afterPhase(PhaseEvent event) {
FacesContext fc = event.getFacesContext();
NavigationHandler nh = fc.getApplication().getNavigationHandler();
nh.handleNavigation(fc, null, "OUTCOME_DEFINED_IN_FACES_CONFIG_XML");
}
Also the first snippet will work with an IceFaces Faces provider, but not Sun JSF 1.2 which is what I need to use. Is there something I can do to fix the code so it is possible to forward to specific URLs?