connection - Spring Restcontroller - 检查客户端是否断开连接
问题描述
是否有可能检查 Spring RestController,客户端是否关闭了连接?
我尝试实现这样的事情:
@GetMapping
public ResponseEntity<Resource> createZipFile(@PathVariable String id) {
// ...
for (Task task : tasks) {
boolean connectionBroken = // ???
if (connectionBroken) {
// exit!
}
// execute task which might take a bit time...
}
// Return result...
}
解决方案
推荐阅读
- javascript - 在 Vue (CKEditor) 中访问组件的实例
- css - flex-child 内 iframe 上的 height="100%" 在 Safari 中不起作用
- iis - 现有 IIS 10 ASP.NET MVC 站点上安装的 Asp.net 核心?
- elasticsearch - 当我们可以在弹性搜索中保存文档时,为什么还需要另一个 Nosql
- makefile - 如何导入 yaml 文件以在 gnu make 文件中使用它?
- c# - 用于字符串比较的 Roslyn Analyzer
- android - Flutter Dynamic Icons 未在生产版本中显示
- javascript - LeafletJS 工具提示偏移量取决于 properties.name
- reactjs - 使用 LocalStorage 反应钩子
- ios - 如何在不阻塞主线程的情况下渲染 UIView?