smart-http v1.1.7 发布,可编程的国产 Http 应用微内核

栏目: 软件资讯 · 发布时间: 4年前

内容简介:smart-http 是一款基于 smart-socket 的可编程式 http 应用微内核。 你可以将 smart-http 开发的程序部署在任何 Java 8 及以上版本的设备上。经过我们的不懈优化, 已经最大限度的降低程序运行期间对于内存和 GC...

smart-http 是一款基于 smart-socket 的可编程式 http 应用微内核。

你可以将 smart-http 开发的程序部署在任何 Java 8 及以上版本的设备上。经过我们的不懈优化, 已经最大限度的降低程序运行期间对于内存和 GC 的开销。smart-http,是一款体现了作为开源人的工匠精神的作品。

开发示例

服务端

public class SimpleSmartHttp {
    public static void main(String[] args) {
        HttpBootstrap bootstrap = new HttpBootstrap();
        bootstrap.httpHandler(new HttpServerHandler() {
            @Override
            public void handle(HttpRequest request, HttpResponse response) throws IOException {
                response.write("hello smart-http<br/>".getBytes());
            }
        });
        bootstrap.setPort(8080).start();
    }
}

客户端 

public class HttpGetDemo {
    public static void main(String[] args) {
        HttpClient httpClient = new HttpClient("www.baidu.com", 80);
        httpClient.connect();
        httpClient.get("/")
                .onSuccess(response -> System.out.println(response.body()))
                .onFailure(Throwable::printStackTrace)
                .send();
    }
}

更新内容

  1. smart-http-server 默认启用 aio-enhance。
  2. client 支持通过代理服务器转发 http 请求。
  3. Http Body 采用响应式解析。
  4. 支持自定义 Http 响应码和描述。
  5. client 支持指定超时时间。
  6. client 支持启用内存池。
  7. client 支持解压 gzip 响应内容。
  8. 优化异常码流可能导致的死循环问题。
  9. 移除 pipeline 的设计。
  10. 优化 Http 协议解析算法。

文档地址

GiteePages:https://smartboot.gitee.io/book/smart-http/

项目地址

Gitee:https://gitee.com/smartboot/smart-http


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Design systems

Design systems

Not all design systems are equally effective. Some can generate coherent user experiences, others produce confusing patchwork designs. Some inspire teams to contribute to them, others are neglected. S......一起来看看 《Design systems》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器