Do not cache processed template content. It is rarely needed and not that expensive

to produce. Also fixes bug 149, hsp templates not updated.
This commit is contained in:
hns 2002-10-31 15:17:14 +00:00
parent 1cdb1d6199
commit 3b6c99a2f5

View file

@ -24,7 +24,6 @@ import helma.framework.core.*;
public class Template extends ActionFile { public class Template extends ActionFile {
String processedContent = null;
public Template (File file, String name, Prototype proto) { public Template (File file, String name, Prototype proto) {
super (file, name, proto); super (file, name, proto);
@ -34,20 +33,16 @@ public class Template extends ActionFile {
super (content, name, sourceName, proto); super (content, name, sourceName, proto);
} }
public String getFunctionName () { public String getFunctionName () {
return name; return name;
} }
public Reader getReader () { public Reader getReader () {
return new StringReader(getContent()); return new StringReader(getContent());
} }
public String getContent () { public String getContent () {
if (processedContent != null)
return processedContent;
Vector partBuffer = new Vector (); Vector partBuffer = new Vector ();
String cstring = super.getContent(); String cstring = super.getContent();
char[] cnt = cstring.toCharArray (); char[] cnt = cstring.toCharArray ();
@ -149,8 +144,7 @@ public class Template extends ActionFile {
} }
// templateBody.append ("\r\nreturn null;\r\n"); // templateBody.append ("\r\nreturn null;\r\n");
processedContent = templateBody.toString (); return templateBody.toString ();
return processedContent;
} }
public void remove () { public void remove () {