设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

smart-http 1.0.15发布,轻量级的国产HTTP服务器

2020-6-22 14:05| 发布者: joejoe0332| 查看: 314| 评论: 0|原作者: oschina|来自: oschina

摘要: smart-http 是一款采用 Java 语言编写的 Http 服务器,有别于业界知名的 Web容器:Tomcat、Undertow,smart-http 并不支持 Servlet 规范,但对于Http 服务器所需的各项能力,它都具备。 smart-http 天生就是异步非阻 ...

smart-http 是一款采用 Java 语言编写的 Http 服务器,有别于业界知名的 Web容器:Tomcat、Undertow,smart-http 并不支持 Servlet 规范,但对于 Http 服务器所需的各项能力,它都具备。

smart-http 天生就是异步非阻塞的 I/O 模型,因为其通信内核采用了 smart-socket。所以无论是性能还是稳定性,都是非常出色的。 

更新内容

  1. 优化Http Request的流操作
  2. 修复长连接状态下的个别字段未重置问题。
  3. 支持Http1.0协议的长连接。
  4. 增加畸形报文攻击防范策略。
  5. WebSocketResponse 新增 flush 接口。
  6. 升级 smart-socket 至 1.4.12。

快速体验

  1. 在您的Maven工程中引入smart-http依赖。
    <dependency>
        <groupId>org.smartboot.http</groupId>
        <artifactId>smart-http-server</artifactId>
        <version>1.0.15</version>
    </dependency>

     

  2. 拷贝以下代码并启动。
    public class SimpleSmartHttp {
        public static void main(String[] args) {
            HttpBootstrap bootstrap = new HttpBootstrap();
            //http消息
            bootstrap.pipeline().next(new HttpHandle() {
                public void doHandle(HttpRequest request, HttpResponse response) throws IOException {
                    response.write("hello world".getBytes());
                }
            });
            //websocket消息
            bootstrap.wsPipeline().next(new WebSocketHandle() {
                public void doHandle(WebSocketRequest request, WebSocketResponse response) throws IOException {
                    response.sendTextMessage("hello world");
                }
            });
            bootstrap.setPort(8080).start();
        }
    }

     

  3. 浏览器访问:http://localhost:8080/ 或采用ws客户端请求ws://127.0.0.1:8080

更多文档请访问:https://smartboot.gitee.io/book/smart-http/


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部