public void processAction(ActionEvent event) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(MessageFormat.format("processAction({0})",
event.getComponent().getId()));
}
UIComponent source = event.getComponent();
ActionSource actionSource = (ActionSource) source;
FacesContext context = FacesContext.getCurrentInstance();
Application application = context.getApplication();
Object invokeResult;
String outcome = null;
MethodBinding binding;
binding = actionSource.getAction();
if (binding != null) {
try {
if (null != (invokeResult = binding.invoke(context, null))) {
outcome = invokeResult.toString();
}
// else, default to null, as assigned above.
} catch (MethodNotFoundException e) {
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
throw new FacesException
(binding.getExpressionString() + ": " + e.getMessage(),
e);
}
catch (EvaluationException e) {
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
throw new FacesException
(binding.getExpressionString() + ": " + e.getMessage(),
e);
}
}
// Retrieve the NavigationHandler instance..
NavigationHandler navHandler = application.getNavigationHandler();
// Invoke nav handling..
navHandler.handleNavigation(context,
(null != binding) ?
binding.getExpressionString() : null,
outcome);
// Trigger a switch to Render Response if needed
context.renderResponse();
}
|