1 package org.apache.turbine.util.template; 2 3 18 19 import org.apache.turbine.services.pull.ApplicationTool; 20 import org.apache.turbine.util.DynamicURI; 21 import org.apache.turbine.util.RunData; 22 import org.apache.turbine.util.ServerData; 23 24 42 public class TemplateLink 43 extends DynamicURI 44 implements ApplicationTool 45 { 46 47 private static final String TEMPLATE_KEY = "template"; 48 49 50 private String template = null; 51 52 57 public TemplateLink() 58 { 59 } 60 61 66 public TemplateLink(RunData data) 67 { 68 super(data); 69 } 70 71 76 public TemplateLink(ServerData data) 77 { 78 super(data); 79 } 80 81 88 public void init(Object data) 89 { 90 if(!(data instanceof RunData) || data == null) 91 { 92 throw new IllegalArgumentException ( 93 "Argument must be an instance of RunData"); 94 } 95 super.init((RunData) data); 96 } 97 98 101 public void refresh() 102 { 103 } 105 106 113 public TemplateLink setEncodeURLOff() 114 { 115 this.res = null; 116 return this; 117 } 118 119 125 public TemplateLink setPage(String template) 126 { 127 this.template = template; 128 addPathInfo(TEMPLATE_KEY, template); 129 return this; 130 } 131 132 138 public String getPage() 139 { 140 return template; 141 } 142 143 150 public String toString() 151 { 152 assertInitialized(); 153 String output = super.toString(); 154 155 removePathInfo(); 158 removeQueryData(); 159 160 return output; 161 } 162 163 171 public String getURI() 172 { 173 return super.toString(); 174 } 175 } 176 | Popular Tags |