unico 2003/11/03 09:13:33
Modified: src/blocks/repository/java/org/apache/cocoon/generation
TraversableGenerator.java
Log:
add timeZone configuration option in order to produce proper rfc2068 dates
Revision Changes Path
1.4 +12 -1
cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/generation/TraversableGenerator.java
Index: TraversableGenerator.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/repository/java/org/apache/cocoon/generation/TraversableGenerator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TraversableGenerator.java 28 Oct 2003 16:46:52 -0000 1.3
+++ TraversableGenerator.java 3 Nov 2003 17:13:33 -0000 1.4
@@ -76,6 +76,7 @@
import java.util.Stack;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.TimeZone;
/**
* Generates an XML source hierarchy listing from a Traversable Source.
@@ -115,6 +116,10 @@
* <dd> Sets the format for the date attribute of each node, as
* described in java.text.SimpleDateFormat. If unset, the default
* format for the current locale will be used.
+ * <dt> <i>timeZone</i> (optional)
+ * <dd> Sets the time zone offset ID for the date attribute, as
+ * described in java.util.TimeZone. If unset, the default
+ * system time zone will be used.
* <dt> <i>refreshDelay</i> (optional)
* <dd> Sets the delay (in seconds) between checks on the source hierarchy
* for changed content. Defaults to 1 second.
@@ -220,6 +225,11 @@
} else {
this.dateFormatter = new SimpleDateFormat();
}
+
+ String timeZone = par.getParameter("timeZone",null);
+ if (timeZone != null) {
+ this.dateFormatter.setTimeZone(TimeZone.getTimeZone(timeZone));
+ }
this.sort = par.getParameter("sort", "name");
this.cacheKeyParList.add(this.sort);
@@ -233,6 +243,7 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("depth: " + this.depth);
this.getLogger().debug("dateFormat: " +
this.dateFormatter.toPattern());
+ this.getLogger().debug("timeZone: " + timeZone);
this.getLogger().debug("sort: " + this.sort);
this.getLogger().debug("reverse: " + this.reverse);
this.getLogger().debug("refreshDelay: " + this.refreshDelay);