{"id":20892718,"url":"https://github.com/aweiloveandroid/httprequestprocessor","last_synced_at":"2025-08-17T01:33:15.422Z","repository":{"id":110402887,"uuid":"99236716","full_name":"AweiLoveAndroid/HttpRequestProcessor","owner":"AweiLoveAndroid","description":"网络请求隔离框架简单封装，有两种实现方式：一种是代理模式实现的，一种是工厂模式实现的。","archived":false,"fork":false,"pushed_at":"2017-08-04T06:11:46.000Z","size":140,"stargazers_count":77,"open_issues_count":1,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T11:07:24.174Z","etag":null,"topics":["http","okhttp","volley"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AweiLoveAndroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-03T13:41:53.000Z","updated_at":"2022-04-21T11:05:08.000Z","dependencies_parsed_at":"2023-03-13T13:54:51.407Z","dependency_job_id":null,"html_url":"https://github.com/AweiLoveAndroid/HttpRequestProcessor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AweiLoveAndroid/HttpRequestProcessor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AweiLoveAndroid%2FHttpRequestProcessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AweiLoveAndroid%2FHttpRequestProcessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AweiLoveAndroid%2FHttpRequestProcessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AweiLoveAndroid%2FHttpRequestProcessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AweiLoveAndroid","download_url":"https://codeload.github.com/AweiLoveAndroid/HttpRequestProcessor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AweiLoveAndroid%2FHttpRequestProcessor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270796220,"owners_count":24647319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","okhttp","volley"],"created_at":"2024-11-18T10:13:45.697Z","updated_at":"2025-08-17T01:33:15.399Z","avatar_url":"https://github.com/AweiLoveAndroid.png","language":"Java","readme":"# HttpRequestProcessor\n\u003e ## **网络请求隔离框架，有两种实现方式：一种是代理模式实现的，一种是工厂模式实现的。**\n\n## 使用方式如下：\n\n**先来说说代理模式的使用方法：**\n\n\n\u003e 一、**首先在application里面声明使用哪个框架**\n    \n    \n    public class MyApplication extends Application {\n        @Override\n        public void onCreate() {\n            super.onCreate();\n            //这里只需要一行代码切换网络框架，6不6！！！\n            \n            //初始化Volley方式网络请求代理\n            HttpHelper.init(new VolleyProcessor(this));\n                \n            //初始化Okhttp方式网络请求代理\n            //HttpHelper.init(new OkHttpProcessor());\n        }\n    }\n\n\u003e 二、**在代码里面具体使用**\n\n    \tpublic class MainActivity extends AppCompatActivity implements View.OnClickListener {\n\n\t\tprivate TextView textView;\n\t\tprivate Button button;\n\t\t\n        //快递接口\n\t\tprivate String url2 = \"http://www.kuaidi100.com/query?type=quanfengkuaidi\u0026postid=300008026630\";\n\t\t\n        @Override\n\t\tprotected void onCreate(Bundle savedInstanceState) {\n\t\t\tsuper.onCreate(savedInstanceState);\n\t\t\tsetContentView(R.layout.activity_main);\n\t\t\ttextView = (TextView) findViewById(R.id.textView);\n\t\t\tbutton = (Button) findViewById(R.id.button);\n\t\t\tbutton.setOnClickListener(this);\n\n\t\t}\n\n\t\t@Override\n\t\tpublic void onClick(View v) {\n\t\t\tif (v.getId() == R.id.button) {\n\t\t\t\t//访问网络\n\t\t\t\tHttpHelper.obtain().get(url2,\n\t\t\t\t\tnull, new HttpCallback\u003cExpressBean\u003e() {\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void onSuccess(ExpressBean expressBean) {\n\t\t\t\t\t\t\tStringBuffer sb = new StringBuffer();\n\t\t\t\t\t\t\tif(expressBean != null){\n\t\t\t\t\t\t\t\tArrayList\u003cExpressBean.DataBean\u003e datas = expressBean.data;\n\t\t\t\t\t\t\t\tfor(ExpressBean.DataBean data : datas){\n\t\t\t\t\t\t\t\t\tsb.append(\"时间：\")\n\t\t\t\t\t\t\t\t\t\t.append(data.time+\"\\r\\n\")\n\t\t\t\t\t\t\t\t\t\t.append(\"地点和跟踪进度：\")\n\t\t\t\t\t\t\t\t\t\t.append(data.context+\"\\r\\n\"+\"\\r\\n\");\n\t\t\t\t\t\t\t\t\ttextView.setText(sb.toString());\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void onFailed(String string) {\n\t\t\t\t\t\t\tToast.makeText(MainActivity.this,\"请求失败了。。\"+ string,Toast.LENGTH_SHORT).show();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n-----------------------------------\n是不是很简单？\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweiloveandroid%2Fhttprequestprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faweiloveandroid%2Fhttprequestprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweiloveandroid%2Fhttprequestprocessor/lists"}