|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.template.Template
sunlabs.brazil.template.SetTemplate (view source)
public class SetTemplate
Template (and handler) class for setting and getting values to and from the current (or other) request context. This class is used by the TemplateHandler. The following tags are processed by this class:
The tag<set>
is processed with the following
attributes:
default
is specified and the specified value
was the empty string "", then store this other value in the
property instead. other is only evaluated in this case.
local
is specified, the values only remain for the
duration of the current request. [Deprecated - use namespace=local]
namespace=${SessionID}
, unless set
is
inside the scope of an enclosing namespace
tag.
Namespaces are used to define
variable scopes that may be managed explicitly in template pages.
Two namespaces are treated specially:
request.props
.
server.props
, unless "noserver" is defined
in which case hte "Server" namespace is not treated specially.
The <namespace>
..</namespace>
tag
pairs are used to specify a default namespace other than the
SessionId
for the set and import tags
or manipulate a namespace.
When a namespace is in effect, the request property [prefix].namespace
is set to the current namespace, where [prefix] is the
RewriteContext.templatePrefix. This permits other templates (such as the
ListTemplate) to use the current namespace setting.
These tags don't nest.
attributes for namespace
:
import
default namespace name.
name
is cleared.
name
is removed.
saveOk
is set, then
the specified namespace will be saved loaded from a file in java
properties
format. Relative path names are resolved with respect to the
document root.
saveOk
is set, then
the specified namespace will be stored to a file in java properties
format. Relative path names are resolved with respect to the
document root.
load
or store
, the namespace
names "local" and "server" are treated specially, referring to
"request.props" and "server.props" respectively.
The tag<import>
(and <unimport>
)
are processed with the following
attributes:
The "unimport" taq should probably be replaced by <import>
The "get" (formerly property) tag has the following attributes:
max
characters.
<get foo>
is equivalent to:
<get name="foo">
.
Request Properties:
server.props
In addition, the following properties (prefixed with "headers") are also set:
url
instead of the one in request.url.
Normally, any persistent properties held by the SetTemplate are chained onto the request.props when the init method is found. If this template is installed as an up-stream handler, then the persistent properties associated with the session are made available at that time.
When used as a handler, the following property is used:
Field Summary |
---|
Fields inherited from class sunlabs.brazil.template.Template |
---|
debug |
Constructor Summary | |
---|---|
SetTemplate()
|
Method Summary | |
---|---|
boolean |
doImport(RewriteContext hr)
See if a remembered namespace is actually in use, and import it. |
static File |
file2path(Properties p,
String prefix,
String name)
Convert a file name into a file object. |
boolean |
init(RewriteContext hr)
Chain the session-id properties into the request chain, if there are any. |
boolean |
init(Server server,
String prefix)
Get the 2 SessionManager keys, "sessionTable" and "session" (SessionID). |
static boolean |
load(Properties p,
RewriteContext hr,
String name)
load a namespace from a java properties file |
boolean |
respond(Request request)
Chain a SessionManager entries onto the request properties, and optionally allow setting of request props from query parameters. |
static boolean |
store(Properties p,
RewriteContext hr,
String name,
String title)
Store a namespace into a java properties file |
void |
tag_get(RewriteContext hr)
Replace the tag "get" with the value of the variable specified by the "name" attribute. |
void |
tag_import(RewriteContext hr)
Import all the data from the named namespace. |
void |
tag_namespace(RewriteContext hr)
Set the default namespace for "set" and "import". |
void |
tag_property(RewriteContext hr)
Convert the html tag "property" in to the request's property DEPRECATED - use "get" |
void |
tag_set(RewriteContext hr)
Set the value of a variable. |
void |
tag_slash_namespace(RewriteContext hr)
Clear the default namespace for "set" and "import". |
void |
tag_slash_tag(RewriteContext hr)
Insert a literal ">" |
void |
tag_tag(RewriteContext hr)
Insert a literal "<". |
void |
tag_unimport(RewriteContext hr)
Un-import a previously imported namespace. |
Methods inherited from class sunlabs.brazil.template.Template |
---|
done |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SetTemplate()
Method Detail |
---|
public boolean init(RewriteContext hr)
init
in interface TemplateInterface
init
in class Template
public void tag_set(RewriteContext hr)
Attributes:
public void tag_property(RewriteContext hr)
public void tag_get(RewriteContext hr)
Attributes:
max
characters.
Max must be at least one, and truncation occurs after
any conversions.
set
attribute, and not inserted into the
HTML stream. If none of "namespace", "convert", or "match"
is used, then this simply copies the property from one name
to another.
<get foo>
is equivalent to:
<get name="foo">
.
public void tag_import(RewriteContext hr)
public void tag_unimport(RewriteContext hr)
public void tag_namespace(RewriteContext hr)
public static File file2path(Properties p, String prefix, String name)
p
- properties file to find the doc root inprefix
- the properties prefix for rootname
- the name of the filepublic static boolean load(Properties p, RewriteContext hr, String name)
public static boolean store(Properties p, RewriteContext hr, String name, String title)
public void tag_slash_namespace(RewriteContext hr)
public void tag_tag(RewriteContext hr)
<tag>a href=<property href></tag>
The [optional] attribute "name" may be used to specify the name of the tag, which will be emmitted just after the "<".
public void tag_slash_tag(RewriteContext hr)
public boolean init(Server server, String prefix)
init
in interface Handler
server
- The HTTP server that created this Handler
.
Typical Handler
s will use Server.props
to obtain run-time configuration information.prefix
- The handlers name.
The string this Handler
may prepend to all
of the keys that it uses to extract configuration information
from Server.props
. This is set (by the Server
and ChainHandler
) to help avoid configuration parameter
namespace collisions.
true
if this Handler
initialized
successfully, false
otherwise. If
false
is returned, this Handler
should not be used.public boolean respond(Request request)
respond
in interface Handler
request
- The Request
object that represents the HTTP
request.
true
if the request was handled. A request was
handled if a response was supplied to the client, typically
by calling Request.sendResponse()
or
Request.sendError
.public boolean doImport(RewriteContext hr)
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |