Class PropsTemplate

  extended by sunlabs.brazil.template.Template
      extended by sunlabs.brazil.template.PropsTemplate (view source)
All Implemented Interfaces:
Serializable, TemplateInterface

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:

The query parameters are placed into the request object, prefixed by the value assigned to "query".
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.
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:

The name of the property in props to replace the property tag with.
The value to use if the property is not defined. If no default is specified, the empty string is used instead.
The value is converted before substitution into the content. Convert accepts either:

See Also:
Serialized Form

Field Summary
Fields inherited from class sunlabs.brazil.template.Template
Constructor Summary
Method Summary
 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 property
 void tag_slash_tag(RewriteContext hr)
          Insert a literal ">"
 void tag_tag(RewriteContext hr)
          Insert a literal "<".
Methods inherited from class sunlabs.brazil.template.Template
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PropsTemplate()
Method Detail


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 interface TemplateInterface
init in class Template


public void tag_property(RewriteContext hr)
Convert the html tag "property" in to the request's property

hr - The rewrite context used to fetch the name of the property to substitute. Variable substitution using the style described in Format.getProperty(java.util.Properties, java.lang.String, java.lang.String) is permitted, e.g.: employee.${id}.last


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>


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

Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.