public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
// Prepare data needed by the action
Map objectModel = env.getObjectModel();
SitemapRedirector redirector = PipelinesNode.getRedirector(env);
SourceResolver resolver = getSourceResolver(objectModel);
List mapStack = context.getMapStack();
String resolvedSource = source.resolve(mapStack);
Parameters resolvedParams = MapStackResolver.buildParameters(this.parameters, mapStack);
Map actionResult;
// If action is ThreadSafe, avoid select() and try/catch block (faster !)
if (this.threadSafeAction != null) {
actionResult = this.threadSafeAction.act(
redirector, resolver, objectModel, resolvedSource, resolvedParams );
} else {
Action action = (Action)this.selector.select(this.componentName);
try {
actionResult = action.act(
redirector, resolver, objectModel, resolvedSource, resolvedParams );
} finally {
this.selector.release(action);
}
}
if (redirector.hasRedirected()) {
return true;
}
if (actionResult == null) {
// Action failed