Sep 25th, 2009, 06:41 AM
[Rest] How to unmarshall objects in controller?
In the ItemsController (with @Controller annotation) I have a method with the @RequestMapping(value="/items", method=RequestMethod.GET) annotation. It adds an attribute to a Model and returns a view name. This view is a org.springframework.web.servlet.view.xml.Marshalli ngView with the marshaller property set to a org.springframework.oxm.jaxb.Jaxb2Marshaller. This all works fine.
Now for the RequestMethod.POST part. In the same controller I have a method public String post(RestItem restItem) with the @RequestMapping(value="/items", method=RequestMethod.POST) annotation.
The restItem is sent by the client but not unmarshalled before calling the controller. It's properties are all null. This makes sense, I didn't configure an unmarshaller equivalent of org.springframework.oxm.jaxb.Jaxb2Marshaller anywhere.
Where do I configure this?? What property to set? Or do I need to unmarshall myself?
With kind regards,
Sep 25th, 2009, 07:08 AM
Tags for this Thread