admin管理员组

文章数量:1530928

出现这种错通常是客户端发起请求的参数格式与服务端不一致,如服务端接收的是json格式而请求却提交的form表单。

解决如下:使用 StringEntity封装参数并设置ContentType

    HttpPost httppost = new HttpPost(url);    
    StringEntity entity = new StringEntity(json.toString(), "UTF-8");
    entity.setContentEncoding("UTF-8");
    entity.setContentType("application/json");

    httppost.setEntity(entity);

 

本文标签: ErrorquotHttpPostInvalidliteral