I have a project provide rest service api for client ...

1. upload image, via image/add.xml or image/add.json to server, return xml or json text(include the new image id).
2. get image via image/{id} with a optional format , eg image/{id}.jpg return a jpg stream(the service convert image format when uploaded), if not specify a format, return the uploaded original format...

Now the problem is ....
I define three HttpMessageConverter, in spring config file...
HTML Code:
  <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <property name="messageConverters">
            <util:list id="beanList">
                <ref bean="bufferedImageHttpMessageConverter"/>
                <ref bean="marshallingHttpMessageConverter"/>
                <ref bean="jsonHttpMessageConverter"/>
            </util:list>
        </property>
    </bean>
I define a rest template in a test context file, and use the restTemplate to test the service.

The result is .
1. upload file works well.
2. But it is strange for fetch image...It throw a org.codehaus.jackson.map.JsonMappingException: exception....
the get image code is like the following

PHP Code:
@RequestMapping(method RequestMethod.GETvalue = {"{id}.png""{id}.gif""{id}.jpg""{id}"})
    @
ResponseBody
    
public BufferedImage get(@PathVariable Long id,
            @
RequestParam(value "width"required falseInteger width,
            @
RequestParam(value "height"required falseInteger height,
            
ModelMap modelMap,
            
HttpServletRequest request,
            
HttpServletResponse response) {
        
log.debug(">>>call get method <<<<");
        
log.debug("request paramenters@width =" width ",height=" height);
      .......

        return 
bImage;
    } 
What is wrong? It seems lke it use the JSON converter to convert BufferedImage the response body...

How do fix this problem...

I used the Spring roo to generate the project structure....most of config is use the default...