@Test public void testApacheHttpAndSpecialParam() { String address = "http: HashMap<String, Object> paramGet = new HashMap<>(); paramGet.put("purpose", "justTest"); paramGet.put("dowhat", "nothing"); paramGet.put("heavey", 100); paramGet.put("postField", "accountids,tempdata"); HashMap<String, Object> paramPost = new HashMap<String, Object>() { private static final long serialVersionUID = -7238581792286389468L; { put("accountids", "1234567,789456"); put("tempdata", "justtemp"); } }; String result = ApacheHttpUtil.postRequest(paramGet, paramPost, address); logger.info("testSpecial result: {}", result); }
public static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address) { String getJsonParam = mapToUrl(paramGet); String requestUrl = address + "?" + getJsonParam; String postStr = JSON.toJSONString(paramPost); logger.info("postRequest, requestUrl: [{}], paramPost: [{}]", requestUrl, postStr); return doPostForm(requestUrl, paramPost); }
ApacheHttpUtil { public static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address) { String getJsonParam = mapToUrl(paramGet); String requestUrl = address + "?" + getJsonParam; String postStr = JSON.toJSONString(paramPost); logger.info("postRequest, requestUrl: [{}], paramPost: [{}]", requestUrl, postStr); return doPostForm(requestUrl, paramPost); } }
ApacheHttpUtil { public static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address) { String getJsonParam = mapToUrl(paramGet); String requestUrl = address + "?" + getJsonParam; String postStr = JSON.toJSONString(paramPost); logger.info("postRequest, requestUrl: [{}], paramPost: [{}]", requestUrl, postStr); return doPostForm(requestUrl, paramPost); } private  ApacheHttpUtil(); }
ApacheHttpUtil { public static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address) { String getJsonParam = mapToUrl(paramGet); String requestUrl = address + "?" + getJsonParam; String postStr = JSON.toJSONString(paramPost); logger.info("postRequest, requestUrl: [{}], paramPost: [{}]", requestUrl, postStr); return doPostForm(requestUrl, paramPost); } private  ApacheHttpUtil(); static String doGet(String url); static String doPostForm(String url, Map<String, Object> params); static String getRequest(Map<String, Object> param, String address); static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address); }
ApacheHttpUtil { public static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address) { String getJsonParam = mapToUrl(paramGet); String requestUrl = address + "?" + getJsonParam; String postStr = JSON.toJSONString(paramPost); logger.info("postRequest, requestUrl: [{}], paramPost: [{}]", requestUrl, postStr); return doPostForm(requestUrl, paramPost); } private  ApacheHttpUtil(); static String doGet(String url); static String doPostForm(String url, Map<String, Object> params); static String getRequest(Map<String, Object> param, String address); static String postRequest(Map<String, Object> paramGet, Map<String, Object> paramPost, String address);  }