[英]REST web service found response in postman but not in volley, but the status code found is 200
[英]Get progress status of a REST web service
I have a web page that calls a REST web service to a Java remote server and I would like to get the progress of the process. 我使用 jQuery ajax 從我的 Z2567A5EC9705EB71AC2C98403E 頁面異步調用我的 web 服務。 我怎樣才能做到這一點?
我的 REST web 服務如下所示:
@PostMapping("/main/postData")
public String postData(@RequestParam("values") String values)
{
//process data
//update a global variable with status
}
我試圖在服務 class 中創建一個變量,該變量由我的 web 服務在流程的各個步驟中更新。 然后是返回該變量值的第二個 web 服務。 但是如何在與第一個服務完全相同的時間與第二個 web 服務一起調用 Ajax 循環?
(不知道是不是好辦法,只是一個想法)
您說您有 2 個端點,1 個用於調用流程,另一個用於檢查流程的進度。 您需要以下內容:
var x = setInterval(() => {
fetch('/progressOfProcess').then(function(result) {
//log current progress
console.log(result)
})
}, 1000)
fetch('/yourMainProcess').then(function() {
clearInterval(x)
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.