项目地址:
https://github.com/fzdwx/sky
依赖
<dependency>
<groupId>io.github.fzdwx</groupId>
<artifactId>sky-http-springboot-starter</artifactId>
<version>0.10.6</version>
</dependency>
启动类
import http.HttpServerRequest;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
final ConfigurableApplicationContext run = SpringApplication.run(BurstServerApplication.class);
}
// normal request
@GetMapping("hello")
public String hello(@RequestParam String name) {
return "Hello " + name;
}
// upgrade to websocket
@GetMapping("connect")
public void connect(@RequestParam String name, HttpServerRequest request) {
request.upgradeToWebSocket(ws->{
ws.mountOpen(h -> {
ws.send("Hello " + name);
});
});
}
}
问题
当前项目对servlet的支持不是很好,也不支持filter等servlet提供的功能
Sky是一个基于Spring Boot的项目,通过引入特定依赖即可实现HTTP服务及WebSocket升级功能。该项目包含了一个简单的启动示例,演示了如何处理普通HTTP请求及WebSocket连接升级。需要注意的是,此项目目前对Servlet的支持有限。

被折叠的 条评论
为什么被折叠?



