@RequestMapping(value = "/createItem", method = RequestMethod.POST)
@Override
public void createItem(@RequestParam(value="userId") String userId, @RequestParam(value="title") String title, @RequestParam(value="subtitle") String subtitle, @RequestParam(value="description") String description, @RequestParam(value="category") String category, @RequestParam(value="datapack") String datapack) {
this.itemDAO.createItem(userId, title, subtitle, description, category, datapack);
}
我正在用Spring創建RESTful應用程序。上面的方法工作得很好,但是當數據包長度超過一定長度時會導致錯誤。錯誤說...彈簧參數太長
解析HTTP請求標頭時出錯注意:在DEBUG級別將記錄進一步發生的HTTP 標頭解析錯誤。
我需要傳遞datapack作爲參數,datapack本身將是一個json文件,我將它轉換爲字符串。
datapack文件可能非常複雜而且很大。我該如何解決這個問題?
這裏的請求的例子:上述工程
http://localhost:8090/createItem?userId=test&title=test&subtitle=test&description=test&category=test&datapack=
{
"CLASS": "com.mincom.ellipse.edoi.ejb.menu_item.MENU_ITEMRec",
"INSTANCE": {
"m_creationDate": "20150824",
"m_creationTime": "001616",
"m_creationUser": "SR4187",
"m_lastModDate": "20150824",
"m_lastModTime": "001616",
"m_lastModUser": "SR4187",
"m_menuType": "",
"m_invokationString": "",
"primaryKey": {
"m_uuid": "3b4d95fe3dd3432fb00cde0cc25f903f"
}
}
},
{
"CLASS": "com.mincom.ellipse.edoi.ejb.i18n_descriptions.I18N_DESCRIPTIONSRec",
"INSTANCE": {
"m_creationDate": "20150824",
"m_creationTime": "001616",
"m_creationUser": "SR4187",
"m_lastModDate": "20150824",
"m_lastModTime": "001616",
"m_lastModUser": "SR4187",
"m_description": "CUSTOM_MENU",
"primaryKey": {
"m_locale": "en",
"m_uuid": "3b4d95fe3dd3432fb00cde0cc25f903f"
}
}
},
{
"CLASS": "com.mincom.ellipse.edoi.ejb.top_level_menus.TOP_LEVEL_MENUSRec",
"INSTANCE": {
"m_creationDate": "20150824",
"m_creationUser": "SR4187",
"m_lastModDate": "20150824",
"m_lastModTime": "001620",
"m_creationTime": "001620",
"m_lastModUser": "SR4187",
"m_uuid": "3b4d95fe3dd3432fb00cde0cc25f903f",
"primaryKey": {
"m_name": "SX"
}
}
}
例子,但如果我更長的JSON文件來測試,它不會工作。
您使用的是什麼應用程序服務器?這是春季開機? –
你如何形成你的http請求?你只是提交一個表單或由javaScript生成的莫名其妙? –
無論如何,這些數據有多大?它是如此之大,它必須分成多個HTTP包? –