CaseStruct caseStruct = getViewId(context, fromAction, outcome, toFlowDocumentId);
if (caseStruct != null) {
ExternalContext extContext = context.getExternalContext();
ViewHandler viewHandler = Util.getViewHandler(context);
assert (null != viewHandler);
Flash flash = extContext.getFlash();
boolean isUIViewActionBroadcastAndViewdsDiffer = false;
if (UIViewAction.isProcessingBroadcast(context)) {
flash.setKeepMessages(true);
String viewIdBefore = context.getViewRoot().getViewId();
viewIdBefore = (null == viewIdBefore) ? "" : viewIdBefore;
String viewIdAfter = caseStruct.navCase.getToViewId(context);
viewIdAfter = (null == viewIdAfter) ? "" : viewIdAfter;
isUIViewActionBroadcastAndViewdsDiffer = !viewIdBefore.equals(viewIdAfter);
}
if (caseStruct.navCase.isRedirect() || isUIViewActionBroadcastAndViewdsDiffer) {
// perform a 302 redirect.
String redirectUrl =
viewHandler.getRedirectURL(context,
caseStruct.viewId,
SharedUtils.evaluateExpressions(context, caseStruct.navCase.getParameters()),
caseStruct.navCase.isIncludeViewParams());
try {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "Redirecting to path {0} for outcome {1}and viewId {2}", new Object[]{redirectUrl, outcome, caseStruct.viewId});
}
// encode the redirect to ensure session state
// is maintained
updateRenderTargets(context, caseStruct.viewId);
flash.setRedirect(true);
extContext.redirect(redirectUrl);
} catch (java.io.IOException ioe) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"jsf.redirect_failed_error",
redirectUrl);