# Kalle **Repository Path**: openneusoft/kalle ## Basic Information - **Project Name**: Kalle - **Description**: HttpClient,遵循Http标准协议,支持同步请求和异步请求 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-04-28 - **Last Updated**: 2024-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Kalle ![Logo](./images/logo.svg) Harmonyos platform's Http client. - Form submissions, such as text form and file form - Custom RequestBody, such as files, json and xml - Support SSL, can customize the certificate - Multiple cache modes, using AES to encrypt cached data - Manage cookies like browsers automatically - Cancel the request at any time - Global converter, obtain JavaBean from server - We can choose URLConnection or OkHttp handle socket ```java Kalle.get("http://www.example.com/user") .param("uid", "123") .perform(new SimpleCallback(this) { @Override public void onResponse(SimpleResponse response) { if(response.isSucceed()) { User user = respon.succeed(); } else { Toast.show(response.failed()); } } }); FormBody body = FormBody.newBuilder() .param("uid", "123") .param("age", 18) .binary("file1", binary1) .binary("file2", binary2) .build(); Kalle.post("http://www.example.com") .body(body) .perform(...)(new SimpleCallback() { @Override public void onResponse(SimpleResponse response) { if (response.isSucceed()) { Toast.show(response.succeed()); } else { Toast.show(response.failed()); } } }); Kalle.post("http://www.example.com") .urlParam("filename", file.getName()) .body(new FileBody(file)) .tag(this) .perform(new DialogCallback(this) { @Override public void onResponse(SimpleResponse response) { if (response.isSucceed()) { Toast.show(response.succeed()); } else { Toast.show(response.failed()); } } }); Kalle.Download.get("http://www.example.com/files/abc.apk") .directory("/sdcard") .fileName("kalle.apk") .onProgress(new Download.ProgressBar() { @Override public void onProgress(int progress, long byteCount, long speed) { // progress:[0, 100]; // byteCount: downloaded byte size; // speed: realtime download speed } }) .perform(new DownloadCallback(this) { @Override public void onStart() { // request begin } @Override public void onFinish(String path) { // request finish, file path:path。 } @Override public void onException(Exception e) { // request exception } @Override public void onCancel() { // request cancel } @Override public void onEnd() { // request end } }); ``` - Original project website: https://github.com/yanzhenjie/Kalle - Original project baseline version: v0.1.7, sha1: 6990980db8cd6dc62b5270fbf1f84788a2c70fb4 For documentation and additional information see [the website](https://www.yanzhenjie.com/Kalle). ## Download Kalle uses URLConnection handle socket by default, add this dependency using Gradle: ```groovy implementation 'io.github.dzsf:kalle:1.0.0' ``` If you want to use okhttp handle socket, add this dependency using Gradle: ```groovy implementation 'io.github.dzsf:okalle:1.0.0' ``` Kalle requires at minimum harmonyos SDK 5. ## Contributing Before submitting pull requests, contributors must abide by the [agreement](CONTRIBUTING.md) . ## Versions - v1.0.0 ## License ```text Copyright 2019 Zhenjie Yan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```