Justin Deoliveira a écrit :
Hi Sébastien,
I think you will have to use a string format function against the date
to get this to work with the raw value.
${<timstampField>?string("yyyy-MM-ddTHH:mm:ss")}
with ${validity_start_time?string("yyyy-MM-ddTHH:mm:ss")} ,
i have the following error :
22 oct. 15:24:57 ERROR [freemarker.runtime] -
Expected number, date, or string. validity_start_time evaluated instead to freemarker.template.SimpleHash on line 1, column 3 in time.ftl.
The problematic instruction:
----------
==> ${validity_start_time?string("yyyy-MM-ddTHH:mm:ss")} [on line 1, column 1 in time.ftl]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected number, date, or string. validity_start_time evaluated instead to freemarker.template.SimpleHash on line 1, column 3 in time.ftl.
with ${validity_start_time.value?string("yyyy-MM-ddTHH:mm:ss")}
22 oct. 15:28:59 ERROR [freemarker.runtime] -
Expected method. validity_start_time.value?string evaluated instead to freemarker.template.SimpleScalar on line 1, column 3 in time.ftl.
The problematic instruction:
----------
==> ${validity_start_time.value?string("yyyy-MM-ddTHH:mm:ss")} [on line 1, column 1 in time.ftl]
----------
Java backtrace for programmers:
----------
freemarker.template.TemplateException: Expected method. validity_start_time.value?string evaluated instead to freemarker.template.SimpleScalar on line 1, column 3 in time.ftl.
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
with ${validity_start_time.rawValue?string("yyyy-MM-ddTHH:mm:ss")}
the following one :
22 oct. 15:30:26 ERROR [freemarker.runtime] -
Expression validity_start_time.rawValue is undefined on line 1, column 3 in time.ftl.
The problematic instruction:
----------
==> ${validity_start_time.rawValue?string("yyyy-MM-ddTHH:mm:ss")} [on line 1, column 1 in time.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression validity_start_time.rawValue is undefined on line 1, column 3 in time.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
Try that and let us know how it goes.
Side note: Andrea was right when he stated that the issue here is coming
up because Sébastien is probably using a different locale which is
causing a different default java date format when converting the date to
a string. Which in turn is causing the kml encoder to improperly parse
the date. A better solution may be to force a specific date format when
converting the date to a string, something that is not locale dependent.
maybe that's why seconds disappear...
i 'd like to do some unit test, where should i start ?
Sébastien Geindre wrote:
Justin Deoliveira a écrit :
Hmmm... I am unable to replicate this behaviour with postgis and
timestamp fields. Simple using ${<timstampField>.value} works for me.
Good morning guys, and thanks for helping...
first i update my subversion repository.
and rebuild geoserver.
then, i try this ${<timstampField>.value}, it's better BUT, i lose the seconds...
for data : 2007-10-19 08:13:26 in postgis (timestamp)
anf template ${validity_start_time.value}
<TimeStamp><when>2007-10-19T08:13:00+00:00</when></TimeStamp>
i try the rawValue attribute...
22 oct. 08:32:35 ERROR [freemarker.runtime] -
Expression validity_start_time.rawValue is undefined on line 1, column 3 in time.ftl.
The problematic instruction:
----------
==> ${validity_start_time.rawValue} [on line 1, column 1 in time.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression validity_start_time.rawValue is undefined on line 1, column 3 in time.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.Expression.getStringValue(Expression.java:118)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
Andrea is correct in that having direct access to the raw date may be an
easier way to go. Although i dont think this will work with the kml
encoder out of the box.. i could be wrong.
Sébastien: Can you send me your table structure. And perhaps a subset of
the data in the table in which you are having problems with. I can try
replicating with your data.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
!DSPAM:4007,471c63a5189781137850744!
--
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre __at__ meteo.fr