使用spring rest插入数据库时发生了 前言中不允许有内容 错误
时间:2014-05-30 21:52:15
收藏:0
阅读:237
该错误一般是编码带来的问题,比如在请求post的时候,使用了application/x-www-form-urlencoded的content type
那么请求传过来的string则需要用urlDecoder进行decode。否则就会报上述错误
body = java.net.URLDecoder.decode(body, "UTF-8"); Source source = new StreamSource(new StringReader(body));
评论(0)