Coverage Report - org.webslinger.macros.ContentPathMacro
 
Classes in this File Line Coverage Branch Coverage Complexity
ContentPathMacro
44%
4/9
N/A
1
 
 1  
 package org.webslinger.macros;
 2  
 
 3  
 import java.io.IOException;
 4  
 import java.io.Writer;
 5  
 import java.util.Map;
 6  
 
 7  
 import org.apache.bsf.BSFException;
 8  
 
 9  
 import org.webslinger.Webslinger;
 10  
 import org.webslinger.WebslingerInvoker;
 11  
 import org.webslinger.template.TemplateMacro;
 12  
 import org.webslinger.template.TemplateManager;
 13  
 
 14  
 public class ContentPathMacro implements TemplateMacro {
 15  
     private final String name;
 16  
 
 17  100
     protected ContentPathMacro(String name) {
 18  100
         this.name = name;
 19  100
     }
 20  
 
 21  
     public String getName() {
 22  200
         return name;
 23  
     }
 24  
 
 25  
     public boolean isBlock() {
 26  0
         return false;
 27  
     }
 28  
 
 29  
     public boolean render(TemplateManager manager, Object parent, Writer writer, Args args, Map context, Body body) throws IOException, BSFException {
 30  0
         WebslingerInvoker invoker = ((Webslinger) parent).getInvoker();
 31  0
         writer.write(invoker.getPlan().getNextWebslinger().getServletPath());
 32  0
         return true;
 33  
     }
 34  
 
 35  
     public TemplateMacro newInstance(TemplateManager manager, Object parent, Args args) throws IOException, BSFException {
 36  0
         return this;
 37  
     }
 38  
 }