Class AsyncController
java.lang.Object
cn.net.pap.example.async.controller.AsyncController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasync()org.springframework.http.ResponseEntity<String>cancelTask(String taskId) 取消正在执行的任务org.springframework.web.context.request.async.WebAsyncTask<String>组合任务查询所有任务状态org.springframework.web.context.request.async.WebAsyncTask<String>org.springframework.web.context.request.async.WebAsyncTask<String>org.springframework.http.ResponseEntity<Integer>getProgress(String taskId) 查询任务进度org.springframework.web.context.request.async.WebAsyncTask<String>启动可取消的异步任务
-
Constructor Details
-
AsyncController
public AsyncController()
-
-
Method Details
-
direct
@GetMapping(value="/direct", produces="application/json;charset=UTF-8") public String direct(@RequestParam(value="index",required=false) String index) throws Exception - Throws:
Exception
-
async
@GetMapping(value="/async", produces="application/json;charset=UTF-8") public String async() throws Exception- Throws:
Exception
-
getAsyncData
@GetMapping("/async-data") public org.springframework.web.context.request.async.WebAsyncTask<String> getAsyncData() -
getAsyncWithTimeout
@GetMapping("/async-with-timeout") public org.springframework.web.context.request.async.WebAsyncTask<String> getAsyncWithTimeout() -
compositeAsyncTask
@GetMapping("/composite-async") public org.springframework.web.context.request.async.WebAsyncTask<String> compositeAsyncTask()组合任务- Returns:
-
startTask
@GetMapping("/start-task") public org.springframework.web.context.request.async.WebAsyncTask<String> startTask(@RequestParam String taskId) 启动可取消的异步任务- Parameters:
taskId- 任务ID- Returns:
- WebAsyncTask 异步任务
-
cancelTask
@GetMapping("/cancel-task") public org.springframework.http.ResponseEntity<String> cancelTask(@RequestParam String taskId) 取消正在执行的任务- Parameters:
taskId- 任务ID- Returns:
- 取消结果
-
getProgress
@GetMapping("/progress") public org.springframework.http.ResponseEntity<Integer> getProgress(@RequestParam String taskId) 查询任务进度- Parameters:
taskId- 任务ID- Returns:
- 当前进度(0 - 100)
-
getAllTaskStatus
@GetMapping("/status") public org.springframework.http.ResponseEntity<Map<String,Object>> getAllTaskStatus()查询所有任务状态- Returns:
- 所有活跃任务的状态
-