This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes Jaxb2CollectionHttpMessageConverter:explaination+usage? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Jaxb2CollectionHttpMessageConverter:explaination+usage?" Watch "Jaxb2CollectionHttpMessageConverter:explaination+usage?" New topic
Author

Jaxb2CollectionHttpMessageConverter:explaination+usage?

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 395
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

http://static.springsource.org/spring-framework/docs/3.2.0.M2/reference/html/new-in-3.2.html

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.




;





Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

I have not played with this yet. I know it was added in Spring 3.2 are you using the latest version? Take a look at the format of the XML used in the test case.



[How To Ask Questions][Read before you PM me]
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 395
(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






Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

Glad you got it working and thanks for posting back with what you figured out!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jaxb2CollectionHttpMessageConverter:explaination+usage?
 
Similar Threads
question relating to an error I got during a rest call to @Get count of my model
HttpMessageConverter Vs ContentNegotiatingViewResolver
@xmlrootelement( )
JBoss-RESTEasy-Jackson problem
Spring MVC 3.1 Validation Problem