HttpUtils http = new HttpUtils();
RequestParams params = new RequestParams();
//添加请求头
// params.addHeader("Content-Type", "application/json");
//添加请求参数
params.addBodyParameter("name", name);
params.addBodyParameter("password", password);
//发送请求
http.send(HttpRequest.HttpMethod.POST, url,new RequestCallBack() {
@Override
public void onFailure(HttpException error, String msg) {
//请求失败处理
}
@Override
public void onSuccess(ResponseInfo responseInfo) {
//请求成功处理
}
@Override
public void onStart() {
// 开始执行请求操作
super.onStart();
System.out.println("请求路径:" + this.getRequestUrl());
}
);