当前位置: 首页>>代码示例>>Java>>正文


Java RequestParams类代码示例

本文整理汇总了Java中com.lidroid.xutils.http.RequestParams的典型用法代码示例。如果您正苦于以下问题:Java RequestParams类的具体用法?Java RequestParams怎么用?Java RequestParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RequestParams类属于com.lidroid.xutils.http包,在下文中一共展示了RequestParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: post

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
/**
 * post请求
 * @param url	请求地址
 * @param params	请求参数
 * @param requestCallBackListener	请求回调
 */
public static void post(String url ,RequestParams params , final RequestCallBackListener requestCallBackListener){
	http.configTimeout(1000*10);
	http.send(HttpMethod.POST, url, params, new RequestCallBack<String>() {

		@Override
		public void onSuccess(ResponseInfo<String> response) {
			requestCallBackListener.onSuccess(response.result);
		}
		
		@Override
		public void onFailure(HttpException error, String msg) {
			requestCallBackListener.onFailure(msg);
		}
	});
}
 
开发者ID:Catslovetoplaygames,项目名称:MVP,代码行数:22,代码来源:HttpRequest.java

示例2: doDonate

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
void doDonate(int love_id, String money){
    RequestParams params = new RequestParams();
    params.addHeader("authorization", loginData.getToken());
    params.addBodyParameter("love_id", love_id + "");
    params.addBodyParameter("money", money);

    HttpUtils httpUtils = new HttpUtils();
    httpUtils.configCurrentHttpCacheExpiry(1000);
    httpUtils.send(HttpRequest.HttpMethod.POST, ApiStores.donate, params, new RequestCallBack<String>() {
        @Override
        public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
            Toast.makeText(context, "捐赠成功", Toast.LENGTH_SHORT).show();
            et_donate.setText("");
            getDetails(donation.id);
            CenterFragment.instance.getMyInfo();
        }

        @Override
        public void onFailure(HttpException e, String s) {
            Toast.makeText(context, "请求失败" + s, Toast.LENGTH_SHORT).show();
            Log.e("aaa", e.getMessage());
            Log.e("aaa", s);
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:26,代码来源:DonateDetailActivity.java

示例3: getDetails

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
void getDetails(int donationId){
    RequestParams params = new RequestParams();
    params.addHeader("authorization", loginData.getToken());
    params.addQueryStringParameter("love_id", donationId + "");

    HttpUtils httpUtils = new HttpUtils();
    httpUtils.configCurrentHttpCacheExpiry(1000);
    httpUtils.send(HttpRequest.HttpMethod.GET, ApiStores.getDonationDetail, params, new RequestCallBack<String>() {
        @Override
        public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
            donation = new Gson().fromJson(responseInfo.result, RequestDonation.class).data;
            initViews();
        }

        @Override
        public void onFailure(HttpException e, String s) {
            Toast.makeText(context, "请求失败", Toast.LENGTH_SHORT).show();
            Log.e("aaa", e.getMessage());
            Log.e("aaa", s);
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:23,代码来源:DonateDetailActivity.java

示例4: uploadApply

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void uploadApply(final String certificate, final String name, final String position, final String introduction, final String investorsProjects){
    RequestParams params = new RequestParams();
    params.addHeader("authorization", loginData.getToken());
    params.addBodyParameter("certificate", certificate);
    params.addBodyParameter("name", name);
    params.addBodyParameter("position", position);
    params.addBodyParameter("introduction", introduction);
    params.addBodyParameter("investorsProjects", investorsProjects);

    HttpUtils httpUtils = new HttpUtils();
    httpUtils.send(HttpMethod.POST, "http://116.62.228.37:8000/mine/investors", params, new RequestCallBack<String>() {
        @Override
        public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
            Toast.makeText(delegate.getActivity(), "已提交申请", Toast.LENGTH_SHORT).show();
            delegate.setStatus(3);
        }

        @Override
        public void onFailure(HttpException e, String s) {
            ToastUtil.showToast("uploadFiles failed", delegate.getActivity());
            Log.e("aaa", e.getMessage());
            Log.e("aaa", s);
        }
    });
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:26,代码来源:InvestorsPresenter.java

示例5: get

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
/**
	 * get请求数据
	 * @param view
	 */
	@OnClick(R.id.get)
	public void get(View view) {
		String url = "http://www.weather.com.cn/data/cityinfo/101010100.html";
		RequestParams params = new RequestParams();
/*		//添加请求参数
		params.addBodyParameter(key, value);*/
		
/*		//添加请求头
		params.addHeader(name, value);*/
		http.send(HttpMethod.GET, url, params, new RequestCallBack<String>() {

			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				data.setText(responseInfo.result);
			}

			@Override
			public void onFailure(HttpException error, String msg) {
				Toast.makeText(getActivity(), "访问失败" + msg, Toast.LENGTH_SHORT).show();
			}
			
		});
	}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:28,代码来源:HttpFragment.java

示例6: post

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
/**
	 * post请求数据
	 * @param view
	 */
	@OnClick(R.id.post)
	public void post(View view) {
		//这个地址只支持get, 这里只是示范。
		String url = "http://www.weather.com.cn/data/cityinfo/101010100.html"; 
		RequestParams params = new RequestParams();
		/*		//添加请求参数
		params.addBodyParameter(key, value);*/
		
/*		//添加请求头
		params.addHeader(name, value);*/
		http.send(HttpMethod.POST, url, params, new RequestCallBack<String>() {

			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				data.setText(responseInfo.result);
			}

			@Override
			public void onFailure(HttpException error, String msg) {
				Toast.makeText(getActivity(), "访问失败" + msg, Toast.LENGTH_SHORT).show();
			}
			
		});
		
	}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:30,代码来源:HttpFragment.java

示例7: setRequestParams

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void setRequestParams(RequestParams param) {
    if (param != null) {
        if (uriCharset == null) {
            uriCharset = Charset.forName(param.getCharset());
        }
        List<RequestParams.HeaderItem> headerItems = param.getHeaders();
        if (headerItems != null) {
            for (RequestParams.HeaderItem headerItem : headerItems) {
                if (headerItem.overwrite) {
                    this.setHeader(headerItem.header);
                } else {
                    this.addHeader(headerItem.header);
                }
            }
        }
        this.addQueryStringParams(param.getQueryStringParams());
        this.setEntity(param.getEntity());
    }
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:20,代码来源:HttpRequest.java

示例8: editInfoRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void editInfoRequest(final String oldPassword, final String password, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/user/updatePassword.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams params = new RequestParams();
            params.addBodyParameter("oldPassword", oldPassword);
            params.addBodyParameter("newPassword", password);
            return params;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:24,代码来源:PhotoAlbumNetWork.java

示例9: deletePhotoRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void deletePhotoRequest(final String id, final String belongId, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/photo/delete.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams params = new RequestParams();
            params.addBodyParameter("id", id);
            params.addBodyParameter("belongId", belongId);
            return params;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:24,代码来源:PhotoAlbumNetWork.java

示例10: voteRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void voteRequest(final String photoId, final String belongId, final String vote, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/vote/vote.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams params = new RequestParams();
            params.addBodyParameter("photoId", photoId);
            params.addBodyParameter("voteValue", vote);
            return params;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:24,代码来源:PhotoAlbumNetWork.java

示例11: deleteCommentRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void deleteCommentRequest(final int commentId, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/comment/delete.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams params = new RequestParams();
            params.addBodyParameter("id", String.valueOf(commentId));
            return params;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:23,代码来源:PhotoAlbumNetWork.java

示例12: commitCommentRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void commitCommentRequest(final String commentContent, final int photoId, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/comment/add.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams params = new RequestParams();
            params.addBodyParameter("content", commentContent);
            params.addBodyParameter("photoId", String.valueOf(photoId));
            return params;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:24,代码来源:PhotoAlbumNetWork.java

示例13: setCoverRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void setCoverRequest(final String photoUrl, final int albumId, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/album/setCover.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams params = new RequestParams();
            params.addBodyParameter("url", photoUrl);
            params.addBodyParameter("id", String.valueOf(albumId));
            return params;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:24,代码来源:PhotoAlbumNetWork.java

示例14: getAllPhoto

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void getAllPhoto(final String belongId, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/photo/findAll.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams requestParams = new RequestParams();
            requestParams.addBodyParameter("belongId", belongId);
            return requestParams;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:23,代码来源:PhotoAlbumNetWork.java

示例15: addPhotoRequest

import com.lidroid.xutils.http.RequestParams; //导入依赖的package包/类
public void addPhotoRequest(final String belongId, final File file, final String photoName, INetWorkListener netWorkListener) {
    NetWorkTask netWorkTask = new NetWorkTask() {
        @Override
        public HttpRequest.HttpMethod getHttpMethod() {
            return HttpRequest.HttpMethod.POST;
        }

        @Override
        public String getUrl() {
            return NetWorkConfig.getHttpApiPath() + "/photo/upload.do";
        }

        @Override
        public RequestParams getRequestParams() {
            RequestParams requestParams = new RequestParams();
            requestParams.addHeader("enctype", "multipart/form-data");
            requestParams.addBodyParameter("belongId", belongId);
            requestParams.addBodyParameter("file", file);
            requestParams.addBodyParameter("name", photoName);
            return requestParams;
        }
    };
    netWorkTask.setNetWorkListener(netWorkListener);
    netWorkTask.sendHttpRequest();
}
 
开发者ID:lujianzhi,项目名称:photoalbum,代码行数:26,代码来源:PhotoAlbumNetWork.java


注:本文中的com.lidroid.xutils.http.RequestParams类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。