org.webmacro.resource
Class URLTemplate
java.lang.Object
|
+--org.webmacro.engine.WMTemplate
|
+--org.webmacro.resource.URLTemplate
- All Implemented Interfaces:
- Macro, Template, Visitable
- public class URLTemplate
- extends WMTemplate
FileTemplate objects read their template data from a text file.
Field Summary |
static java.lang.String |
RCS
CVS revision |
Constructor Summary |
URLTemplate(Broker broker,
java.net.URL templateURL)
Instantiate a template based on the specified file
We use can use the special case or URLs like
file:xxxxxx
or
jar:xxxxxx!yyyyyy
extracting the xxxxxx. |
Method Summary |
protected java.io.Reader |
getReader()
Get the stream the template should be read from. |
java.net.URL |
getURL()
return the URL for the current template. |
void |
parse()
Template API |
boolean |
shouldReload()
URL based templates are difficult to detect as changed in general, but the two
special cases for "file:[path]" and "jar:file:[jarpath]![path]" mean we have reference
to the actual file |
java.lang.String |
toString()
Return a name for this template. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RCS
public static final java.lang.String RCS
- CVS revision
URLTemplate
public URLTemplate(Broker broker,
java.net.URL templateURL)
- Instantiate a template based on the specified file
We use can use the special case or URLs like
file:xxxxxx
or
jar:xxxxxx!yyyyyy
extracting the xxxxxx. In the latter case the reference is to the jar containing the
template.
shouldReload
public boolean shouldReload()
- URL based templates are difficult to detect as changed in general, but the two
special cases for "file:[path]" and "jar:file:[jarpath]![path]" mean we have reference
to the actual file
getReader
protected java.io.Reader getReader()
throws java.io.IOException
- Get the stream the template should be read from. Parse will
call this method in order to locate a stream.
- Overrides:
getReader
in class WMTemplate
- Following copied from class:
org.webmacro.engine.WMTemplate
- Throws:
java.io.IOException
- if unable to read template
getURL
public java.net.URL getURL()
- return the URL for the current template.
toString
public java.lang.String toString()
- Return a name for this template. For example, if the template reads
from a file you might want to mention which it is--will be used to
produce error messages describing which template had a problem.
- Overrides:
toString
in class WMTemplate
parse
public void parse()
throws java.io.IOException,
TemplateException
- Description copied from class:
WMTemplate
- Template API
- Overrides:
parse
in class WMTemplate
- Following copied from interface:
org.webmacro.Template
- Throws:
TemplateException
- if the sytax was invalid and we could not recoverjava.io.IOException
- if we could not successfullly read the parseTool