Response{protocol=http/1.1, code=400, message=, url=http:xxxxx 问题就是题目,如何解决?急急急,谢谢各位 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 问题就是code=400,参数正确,为什么会是400呢? 可以贴出 你的 调用接口的代码以及接口代码;比如 jsp代码,和 controller中的接口代码 这是接口中的参数@RequestParam("classRecordId") Integer classRecordId, @RequestBody JSONObject jsonObject调用的代码:private ReturnResult endClass(Integer classId, List<Integer> studentIdList) { Map<String, Object> params = new HashMap<>(3); params.put("classRecordId", classId); params.put("jsonObject", studentIdList); JSONObject jsonObject = new JSONObject(params); String jsonStr = JSON.toJSONString(jsonObject); System.out.println(jsonStr); HttpRequestEntity httpRequestEntity = new HttpRequestEntity.Builder().withUrl(endClassUrl).withPost(true).withPostData(jsonStr).build(); try { Response response = OkHttpUtils.getInstance().httpPostJsonRequest(httpRequestEntity); System.out.println(response.isSuccessful()); } catch (IOException e) { e.printStackTrace(); } 看这个请求参数格式的话@RequestParam("classRecordId") Integer classRecordId, @RequestBody JSONObject jsonObject可以这样试一下将classRecordId参数拼接到访问路径,不要放到params中endClassUrl 拼接参数 endClassUrl += "?classRecordId=" + classRecordId; 域名+api接口+方法接口(endClassUrl += "?classRecordId=" + classRecordId)http://xxxxxx" + /api +/endClassUrl += "?classRecordId=" + classRecordId还是404 url拼接错了 java如何对多表数据进行操作 struts2中select标签 选中值后没有刷新 内容还是原来的 spring中动态加载启动文件的问题 一到笔试题,请大牛给解决一下 谁能给一个ant的配置文件(要求用在j2ee上) 请问:Spring的一个do能刷新两个页面吗? struts-xml的设置是什么意思,查了好久还是。。。 一个超级难得问题。。。高手快来帮帮忙。。在线等。。 关于jbuilder8的一个小问题?(在线等待``) JSTLC标签里面怎么迭代循环 Map的集合? 求助tomcat启动问题 Hibernate
调用的代码:private ReturnResult endClass(Integer classId, List<Integer> studentIdList) {
Map<String, Object> params = new HashMap<>(3);
params.put("classRecordId", classId);
params.put("jsonObject", studentIdList);
JSONObject jsonObject = new JSONObject(params);
String jsonStr = JSON.toJSONString(jsonObject);
System.out.println(jsonStr);
HttpRequestEntity httpRequestEntity = new HttpRequestEntity.Builder().withUrl(endClassUrl).withPost(true).withPostData(jsonStr).build();
try {
Response response = OkHttpUtils.getInstance().httpPostJsonRequest(httpRequestEntity);
System.out.println(response.isSuccessful());
} catch (IOException e) {
e.printStackTrace();
}
可以这样试一下
将classRecordId参数拼接到访问路径,不要放到params中
endClassUrl 拼接参数 endClassUrl += "?classRecordId=" + classRecordId;
http://xxxxxx" + /api +/endClassUrl += "?classRecordId=" + classRecordId
还是404