smart-http 1.0.10 发布,7行代码便可运行的HTTP服务器

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

内容简介:smart-http smart-http 是一款比较简易的 http服务器,其通信内核采用了smart-socket最新版v1.4.4。 也正因使用了 smart-socket,该服务器的性能表现还是非常不错的,在本人的4核CPU下能跑出73W+的 qps。 smart-...

smart-http

smart-http 是一款比较简易的 http服务器,其通信内核采用了smart-socket最新版v1.4.4

也正因使用了 smart-socket,该服务器的性能表现还是非常不错的,在本人的4核CPU下能跑出73W+的 qps。

smart-socket 的每次性能测试都是基于该服务器进行的,相信 smart-http 的表现不会让您失望。

功能列表

  1. 支持GET、POST的HTTP请求。
  2. 提供了URL路由组件,可以快速搭建一套静态服务器。
  3. 支持部分RFC2612规范,后续会逐渐完善。
  4. 支持Https协议,由smart-socket为其赋能。
  5. 具备文件上传的能力。

快速体验

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

     

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

     

  3. 浏览器访问:http://localhost:8080/

项目内还提供了静态文件服务器的示例,欢迎入坑体验。


以上所述就是小编给大家介绍的《smart-http 1.0.10 发布,7行代码便可运行的HTTP服务器》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

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

Visual Thinking

Visual Thinking

Colin Ware / Morgan Kaufmann / 2008-4-18 / USD 49.95

Increasingly, designers need to present information in ways that aid their audiences thinking process. Fortunately, results from the relatively new science of human visual perception provide valuable ......一起来看看 《Visual Thinking》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具