sunlabs.brazil.template
public class ChangedTemplate extends Template implements Serializable
Template
adds an icon to HREFs to indicate when the
file being referred to is new, changed, or unchanged with respect
to the user's session.
In order for the ChangedTemplate
to work, the following
must happen.
ChangedTemplate
. All HREFs seen between
<changed>
and </changed>
tags
will be rewritten so that an appropriate icon appears next to the
HREF.
ChangedTemplate
. Whenever the
ChangedTemplate
sees a file that was named in some
previously seen <changed>
section, that file's
last-accessed time will be updated. Only the files named in a
<changed>
section are tracked.
ChangedTemplate
may have to keep track of a lot of data
per session, specifically, the names of all the files being tracked and
the last time the user accessed them.
The ChangedTemplate
examines the property "fileName", set
(for example) by the FileHandler
, in order to update the
last-accessed time of a file as it passes by. If the "fileName" property
is not set, the last-accessed time will not be updated.
The ChangedTemplate
also assumes that all local HREFs it sees
can be directly translated into the corresponding file name based on the
"root" property and the URL of the current file. Getting that file name
is necessary so its last-modified time (on disk) can be compared to its
last-accessed time (per session).
The ChangedTemplate
uses the following properties:
Handler
or other code may set this
property if it wishes the file to be tracked.
ChangedTemplate
always
rewrites the HREFs, instead of just when they appear within the
<changed>
and </changed>
tags.
Version: @(#)ChangedTemplate.java 2.1
Method Summary | |
---|---|
boolean | done(RewriteContext hr) |
boolean | init(RewriteContext hr)
Records that this file has just been accessed. |
void | tag_a(RewriteContext hr) |
void | tag_changed(RewriteContext hr) |
void | tag_slash_changed(RewriteContext hr) |