Spring Restcontroller-检查客户端是否断开连接

时间:2018-06-22 14:16:43

标签: 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...
}

0 个答案:

没有答案