• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Jaxb2CollectionHttpMessageConverter:explaination+usage?

 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.





;





 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you got it working and thanks for posting back with what you figured out!
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!