提交json 携带cookie
private static Cookie cookie =null;
Request req =Request.create(IP+path, METHOD.POST);
Header header = Header.create();
header.set("Content-Type", "application/json; charset=utf-8");
req.setHeader(header);
req.setData(Json.toJson(map, JsonFormat.compact()));
if(cookie!=null){
req.setCookie(cookie);
}
Response response = Sender.create(req).setTimeout(10000).send();
cookie=response.getCookie();
普通post提交
Request req =Request.create(url, METHOD.POST);
req.getParams().put("task_id", session.getAttribute("pc_task_id"));
req.getParams().put("capchar", customerForm.getName());
Response response = Sender.create(req).send();
设置代理