RESTful JAX-RS JSON DATE serialization format
The default JSON output for dates is the number of millseconds since the Epoch.
In some cases however it might be more useful to use and return a ISO-8601 formatted date.
HST-2 JAX-RS uses Jackson to serialize and deserialize objects to/from JSON, and through the Springframework jaxrsRestJacksonObjectMapper bean configuration you can set a custom date format for its serializer configuration in an overriding spring assembly file. This overriding spring assembly file is normally located in your project at /site/src/main/resources/META-INF/hst-assembly/overrides
You can add the following bean definition in an overriding spring xml assembly file (for example META-INF/hst-assembly/overrides/jackson.xml) to change the default JSON serialization format:
<bean class= "org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetObject"> <bean class= "org.springframework.beans.factory.config.PropertyPathFactoryBean"> <property name="targetObject" ref="jaxrsRestJacksonObjectMapper" /> <property name="propertyPath" value="serializationConfig"/> </bean> </property> <property name="targetMethod" value="setDateFormat"/> <property name="arguments"> <list> <bean class="java.text.SimpleDateFormat"> <constructor-arg value="yyyy-MM-dd'T'HH:mm:ssZZ"/> </bean> </list> </property> </bean>
Also see
http://wiki.fasterxml.com/JacksonFAQDateHandling