红联Linux门户
Linux帮助

Firefly 4.0.21发布,Java的Web框架

发布时间:2017-02-27 16:27:46来源:红联作者:uineqa
Firefly 4.0.21 发布了。Firefly 4.0.21 提供了全新的函数风格的API来构建web应用,并删除大量的弃用代码。Firefly 4.0.21 仅支持Java 8。

用函数风格编写web应用的例子:[code]public class HelloHTTPServerAndClient {
public static void main(String[] args) {
Phaser phaser = new Phaser(2);
HTTP2ServerBuilder httpServer = $.httpServer();
httpServer.router().get("/").handler(ctx -> ctx.write("hello world! ").next())
.router().get("/").handler(ctx -> ctx.end("end message"))
.listen("localhost", 8080);
$.httpClient().get("http://localhost:8080/").submit()
.thenAccept(res -> System.out.println(res.getStringBody()))
.thenAccept(res -> phaser.arrive());
phaser.arriveAndAwaitAdvance();
httpServer.stop();
$.httpClient().stop();
}
}[/code]更多的例子可以参考 Firefly 文档。

更新日志:

HTTP tunnel请求支持

为HTTP服务器/客户端,TCP服务器/客户端,全新设计的函数风格的API

增加了强大的HTTP路由功能

使用Boring SSL引擎替换了JDK SSL引擎

Mustache模板引擎支持

日志增加单个文件最大长度设置

修复了一些bug

软件详情:http://www.fireflysource.com/docs/http-server-and-client.html

下载地址:http://www.fireflysource.com/

来自:开源中国社区
文章评论

共有 0 条评论