public final boolean invoke(Environment env, InvokeContext context)
throws Exception {
Map objectModel = env.getObjectModel();
StreamPipeline pipeline = context.getStreamPipeline();
if (this.mimeType == null) {
// No mime-type set on node
pipeline.setReader(
this.readerName,
source.resolve(context, objectModel),
VariableResolver.buildParameters(this.parameters, context, objectModel)
);
} else {
// mime-type set on node
pipeline.setReader(
this.readerName,
source.resolve(context, objectModel),
VariableResolver.buildParameters(this.parameters, context, objectModel),
this.mimeType
);
}
// Set status code if there is one
if (this.statusCode >= 0) {
env.setStatus(this.statusCode);
}
if (! context.isInternalRequest()) {
// Process pipeline
return pipeline.process(env);
} else {
// Return true : pipeline is finished.
return true;
}