美文网首页
记录我在使用HttpClient在项目A中调项目B的接口遇见的问

记录我在使用HttpClient在项目A中调项目B的接口遇见的问

作者: 这是一个假的程序员 | 来源:发表于2018-08-20 16:45 被阅读0次

1.post方式提交时传参

method.setRequestBody(new NameValuePair[]{new NameValuePair(key, param)});

在使用post提交时,传参需要使用NameValuePair类。

2.乱码

class UTF8PostMethod extends PostMethod{

public UTF8PostMethod(String url){

super(url);

}

@Override

public String getRequestCharSet(){

   return "UTF-8";

}

}

相关文章

网友评论

      本文标题:记录我在使用HttpClient在项目A中调项目B的接口遇见的问

      本文链接:https://www.haomeiwen.com/subject/mypliftx.html