+ curJpf.getClass().getName() );
}
if ( _log.isWarnEnabled() )
{
InternalStringBuilder msg = new InternalStringBuilder( "Tried to pop from empty PageFlow stack." );
msg.append( " Current page flow is " );
msg.append( curJpf != null ? curJpf.getClass().getName() : null );
_log.warn( msg.append( '.' ).toString() );
}
PageFlowException ex = new EmptyNestingStackException( returnAction, curJpf );
InternalUtils.throwPageFlowException( ex, request );
}
// Only nested PageFlowControllers can have return actions.
assert context.getFlowController() instanceof PageFlowController
: context.getFlowController().getClass().getName() + " is not a " + PageFlowController.class.getName();
ActionForward exceptionFwd =
( ( PageFlowController ) context.getFlowController() ).exitNesting( request, response, mapping, form );
if ( exceptionFwd != null ) return exceptionFwd;
PageFlowStack.PushedPageFlow pushedPageFlowWrapper = pfStack.pop( request );
PageFlowController poppedPageFlow = pushedPageFlowWrapper.getPageFlow();
if ( _log.isDebugEnabled() )
{
_log.debug( "Popped PageFlowController " + poppedPageFlow + " from the nesting stack" );
}
InternalUtils.setCurrentPageFlow( poppedPageFlow, request, getServletContext() );
//
// If an ActionInterceptor forwarded to the nested page flow, give it a chance to change the URI as the nested
// flow is returning. If it doesn't, we'll go to the originally-intended Forward.
//
ActionInterceptor interceptor = pushedPageFlowWrapper.getInterceptor();
if ( interceptor != null )
{
return getRegisteredActionForwardHandler().handleInterceptorReturn( context, poppedPageFlow,
pushedPageFlowWrapper, returnAction,
mapping, form, interceptor );
}
//
// Raise the returned action on the popped pageflow.
//
assert returnAction.charAt( 0 ) != '/' : returnAction;
if ( _log.isDebugEnabled() )
{
_log.debug( "Action on popped PageFlowController is " + returnAction );
}
InternalStringBuilder returnActionPath = new InternalStringBuilder( poppedPageFlow.getModulePath() );
returnActionPath.append( '/' ).append( returnAction ).append( PageFlowConstants.ACTION_EXTENSION );
//
// Store the returned form in the request.
//
ActionForm retForm = pageFlowFwd.getFirstOutputForm( request );
if ( retForm != null )
{
InternalUtils.setForwardedFormBean( request, retForm );
ImplicitObjectUtil.loadOutputFormBean( request, InternalUtils.unwrapFormBean( retForm ) );
}
// TODO: delete this deprecated feature (following line). This is the Jpf.NavigateTo.page value.
request.setAttribute( InternalConstants.RETURNING_FROM_NESTING_ATTR, Boolean.TRUE );
//
// Forward to the return-action on the nesting page flow.
//
ActionForward fwd = new ActionForward( returnActionPath.toString(), false );
fwd.setContextRelative( true );
return fwd;
}