1 15 package org.apache.tapestry.services.impl; 16 17 import org.apache.tapestry.IMarkupWriter; 18 import org.apache.tapestry.IPage; 19 import org.apache.tapestry.IRender; 20 import org.apache.tapestry.IRequestCycle; 21 22 35 public class BaseTagWriter implements IRender 36 { 37 38 public void render(IMarkupWriter writer, IRequestCycle cycle) 39 { 40 IPage page = cycle.getPage(); 41 42 StringBuffer sb = new StringBuffer (); 43 sb.append("/"); 44 45 if (page.getNamespace().getId() == null) 46 { 47 String name = page.getPageName(); 48 int slashx = name.lastIndexOf('/'); 49 50 if (slashx > 0) 52 sb.append(name.substring(0, slashx + 1)); 53 } 54 55 String url = cycle.getAbsoluteURL(sb.toString()); 56 57 writer.beginEmpty("base"); 58 writer.attribute("href", url); 59 60 writer.println(); 61 } 62 63 } | Popular Tags |