This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to understand how/when HttpMessageConverter is called to process the request's argument data type.
I try to post List<Computer> with jaxb-annotated Computer.
I expect to be processed by Jaxb2CollectionHttpMessageConverter but it did not happen. Got exception.
My question is am I understanding correctly its usage? (probably no.)
Need some explaination
In support of this feature, the HttpMessageConverter is extended by GenericHttpMessageConverter adding a method for reading content given a specified parameterized type. The new interface is implemented by the MappingJacksonHttpMessageConverter and also by a new Jaxb2CollectionHttpMessageConverter that can read read a generic Collection where the generic type is a JAXB type annotated with @XmlRootElement or @XmlType.
(0. First thing first: thank-you for your dollars Bill.)
I used the latest spring-framework-3.2.1.RELEASE
1. With DEBUGGER, I traced down the exception and found that
By default <mvc:annotation-driven />
does not have/register Jaxb2CollectionHttpMessageConverter. (Wonder why it was not registered by default by design?)
See code 1.
2. So, I did a quick test by programatically registering Jaxb2CollectionHttpMessageConverter. See code 2.
It worked my POST a List because Jaxb2CollectionHttpMessageConverter get called. See TCP/IP mon for the POST+data