smart-http 是一款可编程的 Http 应用微内核,用户可根据自身需求进行 Server 或 Client 的应用开发。
你可以基于它开发 HTTP 代理服务器、网关、静态服务器、http client 工具、性能压测工具等。smart-http 依旧延续着作者一贯秉持的极简、易用、高性能风格,只提供高性能的运行能力和易用的接口设计。把更多的可能性交给开发者,由那些富有创造力的 Java 开发者打造更优秀的 Http 作品。
更新内容
使用示例
1. Server 端
public class SimpleSmartHttp { public static void main(String[] args) { HttpBootstrap bootstrap = new HttpBootstrap(); // 普通http请求 bootstrap.pipeline().next(new HttpHandle() { @Override public void doHandle(HttpRequest request, HttpResponse response) throws IOException { response.write("hello world<br/>".getBytes()); } }); // websocket请求 bootstrap.wsPipeline().next(new WebSocketDefaultHandle() { @Override public void handleTextMessage(WebSocketRequest request, WebSocketResponse response, String data) { response.sendTextMessage("Hello World"); } }); bootstrap.setPort(8080).start(); } }
2. Client 端
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(); } }
最后
如果觉得这个项目还不错,请给我们加个 Star。并且非常欢迎大家为这个项目贡献你的想法和代码,开源不易,且行且珍惜。
评论删除后,数据将无法恢复
smart-http v1.1.2 发布,可编程的国产 Http 应用微内核
smart-http 是一款可编程的 Http 应用微内核,用户可根据自身需求进行 Server 或 Client 的应用开发。
你可以基于它开发 HTTP 代理服务器、网关、静态服务器、http client 工具、性能压测工具等。smart-http 依旧延续着作者一贯秉持的极简、易用、高性能风格,只提供高性能的运行能力和易用的接口设计。把更多的可能性交给开发者,由那些富有创造力的 Java 开发者打造更优秀的 Http 作品。
更新内容
使用示例
1. Server 端
2. Client 端
最后
如果觉得这个项目还不错,请给我们加个 Star。并且非常欢迎大家为这个项目贡献你的想法和代码,开源不易,且行且珍惜。