{
// stay on current ViewRoot
return;
}
NavigationCase navigationCase = getNavigationCase(facesContext, fromAction, outcome);
if (navigationCase != null)
{
if (log.isTraceEnabled())
{
log.trace("handleNavigation fromAction=" + fromAction + " outcome=" + outcome +
" toViewId =" + navigationCase.getToViewId() +
" redirect=" + navigationCase.isRedirect());
}
if (navigationCase.isRedirect() &&
(!PortletUtil.isPortletRequest(facesContext)))
{ // Spec section 7.4.2 says "redirects not possible" in this case for portlets
ExternalContext externalContext = facesContext.getExternalContext();
ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
String redirectPath = viewHandler.getActionURL(facesContext, navigationCase.getToViewId());
try
{
externalContext.redirect(externalContext.encodeActionURL(redirectPath));
}
catch (IOException e)
{
throw new FacesException(e.getMessage(), e);
}
}
else
{
ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
//create new view
String newViewId = navigationCase.getToViewId();
UIViewRoot viewRoot = null;
if (isPartialStateSavingOn(facesContext)) {
viewRoot = viewHandler.restoreView(facesContext,newViewId);
} else {
viewRoot = viewHandler.createView(facesContext, newViewId);