Java Spring和ExtJS“;请求错误”;用POST法

Java Spring和ExtJS“;请求错误”;用POST法,java,javascript,spring,extjs,Java,Javascript,Spring,Extjs,我正试图通过POST将参数从ExtJS发送到Spring应用程序。这是我的控制器: @RequestMapping(value = "/unloadCatalog", method = RequestMethod.POST) public void unloadMappingCatalog(@RequestParam(required = true) String jsonString, HttpServletRequest re

我正试图通过POST将参数从ExtJS发送到Spring应用程序。这是我的控制器:

@RequestMapping(value = "/unloadCatalog", method = RequestMethod.POST)
public void unloadMappingCatalog(@RequestParam(required = true) String jsonString,
                                 HttpServletRequest request, HttpServletResponse response)
{
下面是我用来发送这些参数的Ext JS代码段:

var unloadData = Ext.encode(listObjects);
Ext.Ajax.request({
    url:'content/unloadCatalog',
    method: 'POST',
    params:{
        jsonString: unloadData
    },
    success: function(response, opts){
        // do something
    }
});
但是如果我将json数据
unloadData
作为正文数据发送

Ext.Ajax.request({
    url:'content/unloadCatalog',
    method: 'POST',
    jsonData: unloadData,
    success: function(response, opts){
        // do something
    }
});
然后像这样更改我的控制器:

@RequestMapping(value = "/unloadCatalog", method = RequestMethod.POST)
public void unloadMappingCatalog(@RequestBody String jsonString,
                               HttpServletRequest request, HttpServletResponse response)
{

一切正常。为什么在第一种情况下不起作用?

原因是默认情况下,如果您发布数据,数据将包装在请求正文中,您得到的内容类型为:
application/x-www-form-urlencoded