uploadify http error 406

今天在360急速模式下测试的时候,uploadify上传图片报错406

从网上找原因,网上的观点有两种  1.缺少JAR包   2.添加转化  http://www.myexception.cn/program/1632922.html

我不缺少JAR  添加转化也不可以  

我想到可能是因为@ResponseBody转化MAP之后是application/json   而360接收的是text/json

那我就直接把MAP用JSONObject 转化为字符串 然后再返回  实测可以

@RequestMapping("/uploadFile")
@ResponseBody
public String uploadFile(){
    
//处理
return JSONObject.toJSONString(map) ;
}

最后返回的是字符串

 

注:如果直接转化的是Map 则application/json

如果转换的是String 则 [{"imageUrl":"material_20140807113210605428.jpg"}] as "text/plain;charset=ISO-8859-1" using [org.springframework.http.converter.StringHttpMessageConverter@fc5b01]  浏览器可以接受

 

posted @ 2014-08-07 11:24  wrong_ai  阅读(1100)  评论(0编辑  收藏  举报