Object taskResult = result();
if (log.isDebugEnabled()) log.debug("nextPage action fired. task result is " + taskResult);
// The response to be returned to the user after the task is done.
WOActionResults nextPageResponse = null;
// If user canceled, we just call that controller
if (_wasStoppedByUser) {
if (log.isDebugEnabled())
log.debug("The task was canceled by the user, so now calling " + nextPageForCancelController());
nextPageResponse = nextPageForCancelController().performAction();
} else if (taskResult instanceof Exception) {
// Invoke error controller
IERXPerformWOActionForResult errorController = nextPageForErrorController();
errorController.setResult(_result);
if (log.isDebugEnabled())
log.debug("The task had an error, so now calling " + errorController);
nextPageResponse = errorController.performAction();
} else {
// Invoke the expected result controller
if (log.isDebugEnabled())
log.debug("The task completed normally. Now setting the result, " + taskResult
+ ", and calling " + nextPageForResultController());
nextPageForResultController().setResult(taskResult);
nextPageResponse = nextPageForResultController().performAction();
}
if (log.isDebugEnabled())
log.debug("results = " + (nextPageResponse == null ? "null" : nextPageResponse.toString()));
return nextPageResponse;
}