// only invoke if pipeline is not internally
if (!context.isBuildingPipelineOnly()) {
final EnterSitemapEvent enterEvent = new EnterSitemapEvent(this, environment);
final Iterator i = this.enterSitemapEventListeners.iterator();
while (i.hasNext()) {
final EnterSitemapEventListener current = (EnterSitemapEventListener) i.next();
current.enteredSitemap(enterEvent);
}
}
this.sitemapExecutor.enterSitemap(this, environment.getObjectModel(), this.wrappingProcessor.source.getURI());
// and now process
EnvironmentHelper.enterProcessor(this, environment);
final Redirector oldRedirector = context.getRedirector();
try {
// Build a redirector
TreeProcessorRedirector redirector = new TreeProcessorRedirector(environment, context);
context.setRedirector(redirector);
context.service(this.manager);
context.setLastProcessor(this);
return this.rootNode.invoke(environment, context);
} finally {
EnvironmentHelper.leaveProcessor();
// Restore old redirector
context.setRedirector(oldRedirector);
}
} finally {
if (handle != null) {
this.sitemapExecutor.leaveSitemap(this, environment.getObjectModel());
// invoke listeners
// only invoke if pipeline is not internally
if (!context.isBuildingPipelineOnly()) {
final LeaveSitemapEvent leaveEvent = new LeaveSitemapEvent(this, environment);
final Iterator i = this.leaveSitemapEventListeners.iterator();
while (i.hasNext()) {
final LeaveSitemapEventListener current = (LeaveSitemapEventListener) i.next();
current.leftSitemap(leaveEvent);
}
}
WebAppContextUtils.leavingContext(this.webAppContext, handle);
}