| 1 | |
package org.webslinger.macros; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
import java.io.Writer; |
| 5 | |
import java.util.Map; |
| 6 | |
import javax.servlet.ServletException; |
| 7 | |
|
| 8 | |
import org.apache.bsf.BSFException; |
| 9 | |
|
| 10 | |
import org.webslinger.Webslinger; |
| 11 | |
import org.webslinger.WebslingerInvoker; |
| 12 | |
import org.webslinger.template.TemplateMacro; |
| 13 | |
import org.webslinger.template.TemplateManager; |
| 14 | |
|
| 15 | |
public class ContentMacro extends AbstractSimpleMacro { |
| 16 | |
protected ContentMacro(String name, boolean withTemplate, boolean isBlock) { |
| 17 | 100 | super(name, withTemplate, isBlock); |
| 18 | 100 | } |
| 19 | |
|
| 20 | |
protected boolean render(TemplateManager manager, Webslinger parent, Writer writer, Args args, Map<String, Object> context, Body body) throws IOException, BSFException { |
| 21 | |
|
| 22 | 126 | WebslingerInvoker invoker = parent.getInvoker(); |
| 23 | |
try { |
| 24 | 126 | invoker.getPlan().addTemplates(getTemplates(parent, args, 0)).run(writer); |
| 25 | 0 | } catch (ServletException e) { |
| 26 | 0 | throw (IOException) new IOException(e.getMessage()).initCause(e); |
| 27 | 126 | } |
| 28 | 126 | return true; |
| 29 | |
} |
| 30 | |
} |