• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HttpRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: login

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
@OnClick(R.id.login_button_myFragment)
public void login(View v){
    String phone = telephoneNum.getText().toString();
    String password = passWord.getText().toString();
    if(phone!=null&&password!=null){
        httpUtils.send(HttpRequest.HttpMethod.GET, UrlsConfig.LOGIN, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

            }

            @Override
            public void onFailure(HttpException e, String s) {

            }
        });
    }else{
        Toast.makeText(getActivity(), "信息不完整", Toast.LENGTH_SHORT);
    }
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:21,代码来源:MyFragment.java


示例2: loadData

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
private void loadData(String url) {
    httpUtils = new HttpUtils();
    httpUtils.send(HttpRequest.HttpMethod.POST, url, new RequestCallBack<String>() {

        @Override
        public void onSuccess(ResponseInfo<String> responseInfo) {
            String json = responseInfo.result;
            homeBean = JSON.parseObject(json, HomeBean.class);
            List<HomeBean.DataEntity.App_index_recommandEntity> list1 = homeBean.getData().getApp_index_recommand();
            if (homeBean != null) {
                View headView = getHeadView(inflater);
                ptrlistview.getRefreshableView().addHeaderView(headView);
            }
            list.addAll(list1);
            adapter.notifyDataSetChanged();
        }

        @Override
        public void onFailure(HttpException e, String s) {
            Toast.makeText(getActivity(), "加载数据失败", Toast.LENGTH_SHORT).show();
            View view = ViewStub.inflate(getActivity(),R.layout.faild_layout,null);
        }
    });
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:25,代码来源:HomeFragment.java


示例3: loadData

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
private void loadData() {
    HttpUtils httpUtils = new HttpUtils();
    httpUtils.send(HttpRequest.HttpMethod.POST, UrlsConfig.HUODONG_DETAIL_URL, new RequestCallBack<String>() {
        @Override
        public void onSuccess(ResponseInfo<String> responseInfo) {
            String json = responseInfo.result;
             huoDongBean = JSON.parseObject(json, HuoDongBean.class);
            HuoDongBean.DataEntity.Index_activity_itemEntity  itemEntivity = huoDongBean.getData().getIndex_activity_item();
            bitmapUtils.display(huodong_headview_img,itemEntivity.getImage_url());
            huodong_upimg_name.setText(itemEntivity.getName());
            huodong_people_time.setText(itemEntivity.getActivity_time_tip() + "  " + itemEntivity.getMember_count() + "人参加");
            huodong_huodong_detail_textview.setText(itemEntivity.getDesc());
            List<HuoDongBean.DataEntity.Activity_share_itemEntity> list1 = huoDongBean.getData().getActivity_share_item();
            list.addAll(list1);
            adapter.notifyDataSetChanged();
        }

        @Override
        public void onFailure(HttpException e, String s) {
            Toast.makeText(getApplicationContext(), "数据加载失败", Toast.LENGTH_SHORT).show();
        }
    });
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:24,代码来源:HDdetailActivity.java


示例4: loadData

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
private void loadData(String URL) {
    HttpUtils httpUtils = new HttpUtils();
    httpUtils.send(HttpRequest.HttpMethod.GET, URL, new RequestCallBack<String>() {
        @Override
        public void onSuccess(ResponseInfo<String> responseInfo) {
            String str = responseInfo.result;
            SearchGrid searchGrid = JSONObject.parseObject(str, SearchGrid.class);
            List<SearchGrid.DataEntity.App_share_dish_list_by_propertyEntity> list = searchGrid.getData().getApp_share_dish_list_by_property();
            if (list != null && list.size() > 0) {
                datas.addAll(list);
                adapter.notifyDataSetChanged();
            }
        }

        @Override
        public void onFailure(HttpException e, String s) {

        }
    });
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:21,代码来源:GirdViewActivity.java


示例5: doDonate

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例6: getDetails

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例7: getDataFromServer

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
private void getDataFromServer() {

        HttpUtils utils = new HttpUtils();
        utils.send(HttpRequest.HttpMethod.GET, Constants.TOP_STORIES_URL, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

                String result = responseInfo.result;

                processResult(result);

                PrefUtils.putString(mActivity, Constants.TOP_STORIES_URL, result);
            }

            @Override
            public void onFailure(HttpException e, String s) {

            }
        });
    }
 
开发者ID:AlarmZeng,项目名称:zhishi,代码行数:21,代码来源:MainNewsFragment.java


示例8: getNewsDateFromServer

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
private void getNewsDateFromServer(String itemId) {

        final String url = Constants.MENU_NEWS_URL + itemId;

        HttpUtils utils = new HttpUtils();
        utils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {
                String result = responseInfo.result;
                PrefUtils.putString(mActivity, url, result);
                processResult(result);
            }

            @Override
            public void onFailure(HttpException e, String s) {
                Toast.makeText(mActivity, "网络发生错误", Toast.LENGTH_SHORT).show();
            }
        });
    }
 
开发者ID:AlarmZeng,项目名称:zhishi,代码行数:20,代码来源:NewsFragment.java


示例9: getDataFromServer

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
private void getDataFromServer() {

        HttpUtils utils = new HttpUtils();
        utils.send(HttpRequest.HttpMethod.GET, Constants.SPLASH_URL, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

                String result = responseInfo.result;

                PrefUtils.putString(SplashActivity.this, Constants.SPLASH_URL, result);
            }

            @Override
            public void onFailure(HttpException e, String s) {

                Toast.makeText(SplashActivity.this, "发生错误", Toast.LENGTH_SHORT).show();

                Intent mainIntent = new Intent(SplashActivity.this, MainActivity.class);
                startActivity(mainIntent);
                finish();
                overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
            }
        });
    }
 
开发者ID:AlarmZeng,项目名称:zhishi,代码行数:25,代码来源:SplashActivity.java


示例10: download

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的package包/类
public HttpHandler<File> download(HttpRequest.HttpMethod method, String url, String target,
                                  RequestParams params, boolean autoResume, boolean autoRename, RequestCallBack<File> callback) {

    if (url == null) throw new IllegalArgumentException("url may not be null");
    if (target == null) throw new IllegalArgumentException("target may not be null");

    HttpRequest request = new HttpRequest(method, url);

    HttpHandler<File> handler = new HttpHandler<File>(httpClient, httpContext, responseTextCharset, callback);

    handler.setExpiry(currentRequestExpiry);
    handler.setHttpRedirectHandler(httpRedirectHandler);

    if (params != null) {
        request.setRequestParams(params, handler);
        handler.setPriority(params.getPriority());
    }
    handler.executeOnExecutor(EXECUTOR, request, target, autoResume, autoRename);
    return handler;
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:21,代码来源:HttpUtils.java


示例11: editInfoRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例12: deletePhotoRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例13: voteRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例14: deleteCommentRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例15: commitCommentRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例16: setCoverRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例17: getAllPhoto

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例18: addPhotoRequest

import com.lidroid.xutils.http.client.HttpRequest; //导入依赖的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


示例19: deleteAlbumRequest

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

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

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


示例20: getFindAllUserAlbum

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

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

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NullDBWritable类代码示例发布时间:2022-05-21
下一篇:
Java IContentProposalProvider类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap