-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 André,
On 3/11/13 5:31 PM, André Warnier wrote: > Just by coincidence, I happened to be looking at some HTTP/DAV > output right now (from Apache's DAV), and I noticed this : ... > <D:getcontenttype>application/pdf</D:getcontenttype> > <lp1:creationdate>2012-12-21T09:25:53Z</lp1:creationdate> > <lp1:getlastmodified>Fri, 21 Dec 2012 09:25:53 > GMT</lp1:getlastmodified> > <lp1:getcontentlength>1009325</lp1:getcontentlength> > <lp1:resourcetype/> ... What is the XML Schema being used for the document? I suspect that whatever the "lp1" namespace resolves to indicates that the timestamp should be in xs:dateTime format which /does/ have that format. I dunno if XML Schema allows you to constrain PCDATA, though... Anyhow, consumers of XML will *expect* that all timestamps are in this format. IMHO, it's a much better format than what HTTP specifies for date headers, as it's (nearly) all numeric. Too bad Java's SimpleDateFormat can neither emit nor consume dates in that format. Fortunately, Apache commons has a drop-in replacement for SimpleDateFormat that *does* support it. > So there we have these 2 formats within a same HTTP response from > the same module on the same server and about the same file, both of > which could obviously have used the same format. You're thinking about it in the wrong way(s). First, HTTP only makes claims about the response headers: once the headers are done, it's all bits after that... HTTP has no prevue there. Second, standards are standards. Just because the HTTP date standard is stupid doesn't mean you can just change it to something "better". That would be ... non-standard. What we would need is a new HTTP header field (e.g. Last-Modified-Not-Stupid) that is defined to be in, say, ISO 8601 date format, or even xs:dateTime format or whatever. The problem is that most HTTP-aware toolkits treat date header values all the same -- take a look at HttpServletRequest.getDateHeader()... it will parse a date header using the HTTP standard. We'd have to add a HttpServletRequest.getNonStupidDateHeader() method, etc. Unfortunately, HTTP is pretty much stuck forever. XML has its own rules: xs:dateTime. It's appropriate to use them because the document being returned is XML. > Why make it simple when complicated will do ? Complaining that the commonly-used XML date format doesn't agree with the HTTP date format is like complaining that Microsoft Excel doesn't store dates in ISO 8601 date format but instead as Julian dates in a binary document format. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEAREIAAYFAlE/TNwACgkQ9CaO5/Lv0PBaigCgi77IYLBmeDp+HW3FirF65H2I C+8AoIIx7I9C6XlWRSn1AHL1s4Sq062j =Y4y6 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org