{ "id": 1234, "name": "John Doe", "lastModified": "2012-03-03 14:40"}The interesting part in this scenario is the last modified date, returned in the format "yyyy-MM-dd HH:mm" in GMT time.
The service itself is quite old and we hadn't had any problems with it until a new client was being developed and wanted to use this service. When the new client was hitting the service it was returning the wrong date format.
The JSP view had the following:
{ "id": ${object.id}, "name": ${object.name}, "lastModified":<fmt:formatedate pattern="yyyy-MM-dd HH:mm" values="${object.lastModified}" /> }Digging through apaches implementation of the tag I found something interesting.
If a web request was to come in without the request header Accept-Language: <LANG>. The implementation will call the toString method of the date object. Interestingly enough, search engines don't send this either so beware.
No comments:
Post a Comment