<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
    public static String postJsonMethodParamsEncode(String postURL,Map<String,String> destMap){
log.info("postJsonMethodParamsEncode request postURL:{}",postURL);
try {
PostMethod postMethod = null;
postMethod = new PostMethod(postURL) ;
postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") ;
NameValuePair[] data = new NameValuePair[destMap.size()];
int i = 0;
for (String key : destMap.keySet()){
data[i] = new NameValuePair(key,destMap.get(key));
i++;
} postMethod.setRequestBody(data);
HttpClient httpClient = new HttpClient();
int response = httpClient.executeMethod(postMethod);
return postMethod.getResponseBodyAsString() ;
} catch (Exception e) {
log.error("请求异常:",e);
throw new RuntimeException(e.getMessage());
}
}

最新文章

  1. JQuery------分页插件下载地址
  2. 关于C语言的问卷调查
  3. WCF 服务的ABC之绑定(六)
  4. 使用spm build 批量打包压缩seajs 代码
  5. 重拾C++ 基础知识总结(一)
  6. linkin大话数据结构--Collection和Iterator
  7. 【C语言】多项式加法(mooc第七周测试题)
  8. python中os模块操作目录与文件名小结
  9. OpenCV 学习笔记 06 图像检索以及基于图像描述符的搜索
  10. 2-sat相关复习
  11. ubuntu vi配置
  12. nginx的启动和关闭
  13. 安装配置SVN
  14. IP地址分配机构
  15. zTree第二章,各种常见setting设置和方法
  16. 【转载】MDX Step by Step 读书笔记(四) - Working with Sets (使用集合)
  17. Linux下的高级拾色器—Pick
  18. STL源码剖析(deque)
  19. Alpha matting算法发展
  20. [ZOJ3316]Game

热门文章

  1. vue input输入框关键字筛选检索列表数据展示
  2. fetch,axios简介与语法
  3. Hadoop批处理方案 和 MPP架构方案 作为数据仓库的区别
  4. NGINX websocket 配制
  5. 【Java学习Day05】LDEA的安装和使用
  6. strace 跟踪特定系统调用
  7. nmap扫描结果保存 xml to html for windows
  8. R语言码农的Scala学习心得
  9. studiostyl.es网站scheme文件无法下载
  10. PHP 8 Apache 2.4