Package sunlabs.brazil.template
Class PropsTemplate
- java.lang.Object
-
- sunlabs.brazil.template.Template
-
- sunlabs.brazil.template.PropsTemplate
-
- All Implemented Interfaces:
java.io.Serializable
,TemplateInterface
public class PropsTemplate extends Template implements java.io.Serializable
[Deprecated, use the the SetTemplate.]
Template class for substituting request properties into an HTML page. This class is used by the TemplateHandler The following request properties are used:- query
- The query parameters are placed into the request object, prefixed by the value assigned to "query".
- headers
- The mime headers are placed into the request object, prefixed by the value assigned to "headers". The values: url, query, method, and version are copied from the request object into the properties. The clients IP address is saved in the "address" property.
- url.orig
- If set and "headers" are requested, this value is used as
the
url
instead of the one in request.url.
A new HTML tag,
<property>
is defined. It takes the following tag attributes:- name
- The name of the property in
props
to replace theproperty
tag with. - default
- The value to use if the property is not defined.
If no
default
is specified, the empty string is used instead. - convert
- The value is converted before substitution into
the content. Convert accepts either:
- convert=htmlProtect plain text by escaping the characters " < > and &.
- convert=urlMake sure the string is suitable for use in a url or query string.
- Version:
- %V% PropsTemplate.java 2.4
- Author:
- Stephen Uhler
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PropsTemplate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
init(RewriteContext hr)
This gets called at every page, at the beginning.void
tag_property(RewriteContext hr)
Convert the html tag "property" in to the request's propertyvoid
tag_slash_tag(RewriteContext hr)
Insert a literal ">"void
tag_tag(RewriteContext hr)
Insert a literal "<".
-
-
-
Method Detail
-
init
public boolean init(RewriteContext hr)
This gets called at every page, at the beginning. See if we should add the mime headers and query parameters into the request object- Specified by:
init
in interfaceTemplateInterface
- Overrides:
init
in classTemplate
-
tag_property
public void tag_property(RewriteContext hr)
Convert the html tag "property" in to the request's property- Parameters:
key
- The name of the property to substitute. Variable substitution using the style described inFormat.getProperty(java.util.Properties, java.lang.String, java.lang.String)
is permitted, e.g.:employee.${id}.last
-
tag_tag
public void tag_tag(RewriteContext hr)
Insert a literal "<". Using the current scheme, there is no easy way to substitute into a tag parameter. So we'll invent a "magic" tag (called tag) that will allow us to create entities dynamically. Thus values can be substituted into entities by escaping the entity as in:<tag>a href=<property href></tag>
-
tag_slash_tag
public void tag_slash_tag(RewriteContext hr)
Insert a literal ">"
-
-