致力于实现 Http 服务器国产化,smart-http 1.1.5 发布

来源: 投稿
2021-06-09 09:31:00

smart-http 是一款基于 smart-socket 的可编程式 http 应用微内核,同时还是为数不多的专注于服务器领域的国产开源项目。

smart-http 采用了基于状态驱动的算法进行 Http 协议解码,这是一种对初中级开发人员极为友好的算法,以结构化的形式展示完整的 Http 解码过程。与此同时,在 smart-socket 强大通信能力的加持下,smart-http 的性能表现已属于业内顶尖水准。

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

开发示例

服务端

public class SimpleSmartHttp {
    public static void main(String[] args) {
        HttpBootstrap bootstrap = new HttpBootstrap();
        bootstrap.pipeline(new HttpServerHandle() {
            @Override
            public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
                response.write("hello world<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. 优化:引入跳跃式解码算法, 提升Http数据帧遍历效率。
  2. 优化:引入字符串常量池,提升解码效率并缓解 GC。
  3. 优化:提升 HttpRouteHandle 对于精准路径的路由匹配速度。
  4. 优化:升级 smart-socket 至最新版 1.5.9。
  5. 新特性:新增单元测试模块。

文档地址

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

项目地址

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

展开阅读全文
点击加入讨论🔥(18) 发布并加入讨论🔥
本篇精彩评论
看标题 哈哈哈哈哈
2021-06-09 13:54
3
举报
“致力于实现 Http 服务器国产化” 哈哈哈。
2021-06-09 12:46
2
举报
18 评论
8 收藏
分享
返回顶部
顶部