public ProcessingNode buildNode(Configuration config) throws Exception {
if (((SitemapLanguage)this.treeBuilder).isBuildingErrorHandler()) {
throw new ConfigurationException("'map:redirect' is forbidden inside a 'map:handle-errors', at "
+ config.getLocation());
}
// Is it a redirect to resource ?
this.resourceName = config.getAttribute("resource", null);
if (this.resourceName != null) {
getLogger().warn("Redirect to resource is deprecated. Use map:call instead at " +
config.getLocation());
this.callNode = new CallNode();
this.treeBuilder.setupNode(this.callNode, config);
String target = config.getAttribute("target", null);
if (target != null) {
Map params = new HashMap(1);
params.put("target", VariableResolverFactory.getResolver(target, this.manager));
this.callNode.setParameters(params);
}
return this.callNode;
} else {
ProcessingNode URINode = new RedirectToURINode(
VariableResolverFactory.getResolver(config.getAttribute("uri"), this.manager),
config.getAttributeAsBoolean("session", false),
config.getAttributeAsBoolean("global", false),
config.getAttributeAsBoolean("permanent", false)
);
return this.treeBuilder.setupNode(URINode, config);
}
}
|