{"id":15330657,"url":"https://github.com/openfacade/http-facade","last_synced_at":"2026-03-07T03:03:53.848Z","repository":{"id":256924133,"uuid":"856835472","full_name":"openfacade/http-facade","owner":"openfacade","description":"Simple Http Client/Server Facade for Java","archived":false,"fork":false,"pushed_at":"2025-09-23T12:02:59.000Z","size":302,"stargazers_count":9,"open_issues_count":1,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-24T00:48:53.036Z","etag":null,"topics":["facade","http","http-client","http-server","java"],"latest_commit_sha":null,"homepage":"https://github.com/openfacade","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/openfacade.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-13T09:46:54.000Z","updated_at":"2025-12-12T02:48:02.000Z","dependencies_parsed_at":"2024-10-28T13:12:49.883Z","dependency_job_id":"7dba6d7c-500b-4bea-909c-3d5a964aa44d","html_url":"https://github.com/openfacade/http-facade","commit_stats":{"total_commits":38,"total_committers":3,"mean_commits":"12.666666666666666","dds":0.1578947368421053,"last_synced_commit":"58b1899e1d7656c966779eb9c19585f2c14f602a"},"previous_names":["shoothzj/http-client-facade","shoothzj/http-facade","openfacade/http-facade"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/openfacade/http-facade","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfacade%2Fhttp-facade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfacade%2Fhttp-facade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfacade%2Fhttp-facade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfacade%2Fhttp-facade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openfacade","download_url":"https://codeload.github.com/openfacade/http-facade/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfacade%2Fhttp-facade/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30206341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"online","status_checked_at":"2026-03-07T02:00:06.765Z","response_time":53,"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":["facade","http","http-client","http-server","java"],"created_at":"2024-10-01T09:53:51.131Z","updated_at":"2026-03-07T03:03:53.823Z","avatar_url":"https://github.com/openfacade.png","language":"Java","readme":"# HTTP Facade\n![color](images/fulllogo_nobuffer.png)\n![License](https://img.shields.io/badge/license-Apache2.0-green)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/11002/badge)](https://www.bestpractices.dev/projects/11002)\n![Language](https://img.shields.io/badge/language-Java-blue.svg)\n[![version](https://img.shields.io/github/v/tag/openfacade/http-facade?label=release\u0026color=blue)](https://github.com/openfacade/http-facade/releases)\n[![codecov](https://codecov.io/gh/openfacade/http-facade/branch/main/graph/badge.svg)](https://codecov.io/gh/openfacade/http-facade)\n\nEnglish | [简体中文](README_CN.md)\n\n`HTTP Facade` is a flexible Java library that provides a unified API for both HTTP clients and HTTP servers(WIP). The library supports multiple underlying implementations (e.g., OkHttp, AsyncHttpClient for clients) and provides easy configuration of HTTP requests and responses, connection timeouts, TLS settings, routing, and more.\n\n## Why Use a Facade Library?\n\nThe `HTTP Facade` library offers a streamlined approach for integrating multiple HTTP client implementations within a single application.\nBy providing a unified API, it abstracts the complexities of various HTTP engines (such as `OkHttp` or `AsyncHttpClient`) while allowing easy configuration of essential features like request timeouts, TLS settings.\n\nIn many integration scenarios, applications based on HTTP libraries may need to adapt to specific requirements.\nFor instance, some embedded environments prioritize smaller footprint sizes, Android applications require platform-specific compatibility, and other cases may demand high performance and low latency.\nIn these situations, using a thin facade layer can be highly advantageous, allowing developers to meet diverse needs without rewriting core logic or managing multiple client libraries.\nInstead, `HTTP Facade` enables easy switching between implementations, ensuring consistency, simplicity, and enhanced maintainability across various use cases.\n\n## HttpClientFacade\n\n### HttpClient Support Engines\n\n- [**AsyncHttpClient**](https://github.com/AsyncHttpClient/async-http-client)\n- **JavaHttpClient**: Java11+ built-in HTTP client\n- **Java8HttpClient**: Java8 built-in HTTP client\n- [**JettyHttpClient**](https://github.com/jetty/jetty.project)\n- [**OkHttpClient**](https://github.com/square/okhttp)\n- [**VertxHttpClient**](https://github.com/vert-x3/vertx-web)\n\n### Installation\n\nBy default, the `HttpClientFacade` uses the built-in HTTP engine provided by the JDK. It automatically selects the appropriate implementation based on the Java version, supporting both Java 8 and Java 11+. However, if you wish to use a specific HTTP engine like `OkHttp` or `AsyncHttpClient`, you'll need to add the corresponding dependencies.\n\n#### Maven\n\nAdd the following dependency to your `pom.xml` to include the default `http-facade`:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.openfacade\u003c/groupId\u003e\n    \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n    \u003cversion\u003e${http-facade.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIf you'd like to use a specific HTTP engine, you need to add additional dependencies:\n\n- **ApacheHttpClient**:\n\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.openfacade\u003c/groupId\u003e\n      \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n      \u003cversion\u003e${http-facade.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003eorg.apache.httpcomponents.client5\u003c/groupId\u003e\n      \u003cartifactId\u003ehttpclient5\u003c/artifactId\u003e\n      \u003cversion\u003e${apache-http-client.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  ```\n\n- **AsyncHttpClient**:\n\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.openfacade\u003c/groupId\u003e\n      \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n      \u003cversion\u003e${http-facade.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003eorg.asynchttpclient\u003c/groupId\u003e\n      \u003cartifactId\u003easync-http-client\u003c/artifactId\u003e\n      \u003cversion\u003e${asynchttp.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  ```\n\n- **Jetty**:\n\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.openfacade\u003c/groupId\u003e\n      \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n      \u003cversion\u003e${http-facade.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003eorg.eclipse.jetty\u003c/groupId\u003e\n      \u003cartifactId\u003ejetty-client\u003c/artifactId\u003e\n    \u003cversion\u003e${jetty.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  ```\n\n- **OkHttp**:\n\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.openfacade\u003c/groupId\u003e\n      \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n      \u003cversion\u003e${http-facade.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003ecom.squareup.okhttp3\u003c/groupId\u003e\n      \u003cartifactId\u003eokhttp\u003c/artifactId\u003e\n    \u003cversion\u003e${okhttp.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  ```\n\n- **Vertx**:\n\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.openfacade\u003c/groupId\u003e\n      \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n      \u003cversion\u003e${http-facade.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003eio.vertx\u003c/groupId\u003e\n      \u003cartifactId\u003evertx-web-client\u003c/artifactId\u003e\n    \u003cversion\u003e${vertx.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  ```\n\n#### Gradle\n\nFor Gradle users, add the default `http-facade` dependency:\n\n```groovy\nimplementation 'io.github.openfacade:http-facade-client:$httpFacadeVersion'\n```\n\nTo specify an HTTP engine, need to add dependencies:\n\n- **ApacheHttpClient**:\n\n  ```groovy\n  implementation 'io.github.openfacade:http-facade-client-okhttp:$httpFacadeVersion'\n  implementation 'org.apache.httpcomponents.client5:httpclient5:$apacheHttpClientVersion}'\n  ```\n\n- **AsyncHttpClient**:\n\n  ```groovy\n  implementation 'io.github.openfacade:http-facade-client-okhttp:$httpFacadeVersion'\n  implementation 'org.asynchttpclient:async-http-client:$asynchttpVersion'\n  ```\n\n- **Jetty**:\n\n  ```groovy\n  implementation 'io.github.openfacade:http-facade-client-okhttp:$httpFacadeVersion'\n  implementation 'org.eclipse.jetty:jetty-client:$jettyVersion'\n  ```\n\n- **OkHttp**:\n\n  ```groovy\n  implementation 'io.github.openfacade:http-facade-client-okhttp:$httpFacadeVersion'\n  implementation 'com.squareup.okhttp3:okhttp:$okhttpVersion'\n  ```\n\n- **Vertx**:\n\n  ```groovy\n  implementation 'io.github.openfacade:http-facade-client-okhttp:$httpFacadeVersion'\n  implementation 'io.vertx:vertx-web-client:$vertxVersion'\n  ```\n\n### Getting Started\n\n#### 1. Create a Configuration\n\nFirst, create a `HttpClientConfig` to configure timeouts and TLS settings.\n\n```java\nHttpClientConfig config = new HttpClientConfig.Builder()\n    .engine(HttpClientEngine.OKHTTP) // Choose the engine (e.g., OKHTTP, ASYNC_HTTP_CLIENT, JDK)\n    .timeout(Duration.ofSeconds(30)) // Set request timeout\n    .connectTimeout(Duration.ofSeconds(10)) // Set connection timeout\n    .build();\n```\n\n#### 2. Create a Client\n\nUse the `HttpClientFactory` to create the desired client instance with the above configuration.\n\n```java\nHttpClient client = HttpClientFactory.createHttpClient(config);\n```\n\n#### 3. Make HTTP Requests\n\n##### Asynchronous Requests\n\n```java\nCompletableFuture\u003cHttpResponse\u003e future = client.get(\"http://example.com\", Map.of());\nfuture.thenAccept(response -\u003e {\n    System.out.println(\"Status: \" + response.getStatusCode());\n    System.out.println(\"Body: \" + new String(response.getBody()));\n});\n```\n\n##### Synchronous Requests\n\n```java\nHttpResponse response = client.getSync(\"http://example.com\", Map.of());\nSystem.out.println(\"Status: \" + response.getStatusCode());\nSystem.out.println(\"Body: \" + new String(response.getBody()));\n```\n\n#### 4. Close the Client\n\nRemember to close the client when you're done to release any resources.\n\n```java\nclient.close();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfacade%2Fhttp-facade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenfacade%2Fhttp-facade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfacade%2Fhttp-facade/lists"}