Fetch the repository succeeded.
smart-http 是一款可编程的 Http 应用微内核,方便用户根据自身需求进行 Server 或 Client 的应用开发。
感兴趣的朋友请记得 Star一下该项目,并且非常欢迎有能力的朋友贡献你的想法和代码。
<dependency>
<groupId>org.smartboot.http</groupId>
<artifactId>smart-http-server</artifactId>
<version>1.3.1</version>
</dependency>
public class SimpleSmartHttp {
public static void main(String[] args) {
HttpBootstrap bootstrap = new HttpBootstrap();
bootstrap.configuration().debug(true);
bootstrap.httpHandler(new HttpServerHandler() {
@Override
public void handle(HttpRequest request, HttpResponse response) throws IOException {
response.write("hello smart-http<br/>".getBytes());
}
}).setPort(8080).start();
}
}
http://localhost:8080/
,亦或采用websocket请求ws://127.0.0.1:8080/
<dependency>
<groupId>org.smartboot.http</groupId>
<artifactId>smart-http-client</artifactId>
<version>1.3.1</version>
</dependency>
public class HttpGetDemo {
public static void main(String[] args) {
HttpClient httpClient = new HttpClient("www.baidu.com", 80);
httpClient.get("/").header().keepalive(false).done()
.onSuccess(response -> System.out.println(response.body()))
.onFailure(Throwable::printStackTrace)
.done();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.