共计 734 个字符,预计需要花费 2 分钟才能阅读完成。
Sky
我的项目地址:
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 提供的性能。
正文完