内容简介:smart-http 是一款基于 smart-socket 的可编程式 http 应用微内核,同时还是为数不多的专注于服务器领域的国产开源项目。 你可以将 smart-http 开发的程序部署在任何 Java 8 及以上版本的设备上。经过我们的不懈优...
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.pipeline(new HttpServerHandler() {
@Override
public void handle(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();
}
}
更新内容
- 升级 smart-socket 至 1.5.11。
- 修复 HttpServerHandler 空实现时无法正常响应问题。
- 修复 smart-http 在单核环境下默认线程数为 1 导致的启动报错问题。
- 部分代码优化。
文档地址
GiteePages:https://smartboot.gitee.io/book/smart-http/
项目地址
Gitee:https://gitee.com/smartboot/smart-http
以上所述就是小编给大家介绍的《国产开源 Http 服务器,smart-http 1.1.8 发布》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 国产开源 GUI 引擎 AWTK 1.1 发布
- AWTK 1.2 发布,国产开源 GUI 引擎
- “国产自主可控”的开源软件就是一个矛盾体
- 倪光南:未来国产开源芯片将成为主流芯片
- 码云周刊 | 7款优秀的国产开源中间件!
- NewStarBlog 发布 1.0 版本,国产开源 Java 博客平台
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Game Programming Patterns
Robert Nystrom / Genever Benning / 2014-11-2 / USD 39.95
The biggest challenge facing many game programmers is completing their game. Most game projects fizzle out, overwhelmed by the complexity of their own code. Game Programming Patterns tackles that exac......一起来看看 《Game Programming Patterns》 这本书的介绍吧!