Hello friends!
I am trying to build a solution around REST support under Spring 3.0 M3. So far, I have had no problems using GET method, but I can't find how to process a POST. This is how my method looks:
I understand that, according to the manual, there is the need for MessageConverters. I believe the most common of them are pre-registered by Spring. But even if I register my owns on my context, I still keep getting the error:Code:@RequestMapping(value = "/registry/configureService", method = RequestMethod.POST) public ModelAndView configureService(@RequestBody String instanceName, @RequestBody String className, @RequestBody String options) { log.debug("configuring:" + instanceName + ", " + className + ", " + options); ... }
(415) Unsupported Media Type
This is how I tried to register some message converters:
The request body I am posting in this case is a form (Content-Type: application/x-www-form-urlencoded).Code:<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="messageConverters"> <list> <ref bean="stringHttpMessageConverter"/> <ref bean="formHttpMessageConverter"/> </list> </property> </bean> <bean id="formHttpMessageConverter" class="org.springframework.http.converter.FormHttpMessageConverter"/> <bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter"/>
Do you have any idea of what is going wrong?
Thanks in advance,
Alex


Reply With Quote

