use of org.apache.cocoon.pipeline.component.sax.XMLSerializer in project sling by apache.
the class PipelineImpl method eval.
@Override
public void eval() throws Exception {
try {
this.getEnv().setCcPipeline(new NonCachingPipeline());
// generator
AbstractGenerator generator = new SlingGenerator(this.getEnv().getSling());
this.getEnv().getCcPipeline().addComponent(generator);
// subpipeline evaluated
for (Step step : this.getSubpipeline()) {
step.eval();
}
this.getEnv().getCcPipeline().addComponent(new XMLSerializer());
// Don't retrieve OutputStream from response until actually writing
// to response, so that error handlers can retrieve it without getting
// an error
final OutputStream out = new OutputStreamWrapper() {
@Override
protected OutputStream getWrappedStream() throws IOException {
return getEnv().getSling().getResponse().getOutputStream();
}
};
this.getEnv().getCcPipeline().setup(out);
this.getEnv().getCcPipeline().execute();
} catch (Exception e) {
String absPath = this.getEnv().getSling().getRequest().getResource().getPath();
throw new Exception("Error in pipeline for resource: " + absPath, e);
}
}
Aggregations