sunlabs.brazil.template

Class PropsTemplate

public class PropsTemplate extends Template implements 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 {@link sunlabs.brazil.server.Request#props props} to replace the property 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

Method Summary
booleaninit(RewriteContext hr)
This gets called at every page, at the beginning.
voidtag_property(RewriteContext hr)
Convert the html tag "property" in to the request's property
voidtag_slash_tag(RewriteContext hr)
Insert a literal ">"
voidtag_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

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 in {@link Format#getProperty} is permitted, e.g.: employee.${id}.last

tag_slash_tag

public void tag_slash_tag(RewriteContext hr)
Insert a literal ">"

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>