Add status to web sample rest api

This commit is contained in:
Janne Valkealahti
2015-08-01 18:39:49 +01:00
parent 0d7ec09885
commit 70455ed329

View File

@@ -17,6 +17,7 @@ package demo.web;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
@@ -128,7 +129,14 @@ public class StateMachineController {
return stateMachine.getState().getIds();
}
@RequestMapping(value = "/status", method = RequestMethod.GET, produces="application/json")
@ResponseBody
public Map<Object, Object> getStatus() {
HashMap<Object, Object> map = new HashMap<Object, Object>();
map.put("hasStateMachineError", stateMachine.hasStateMachineError());
map.put("isComplete", stateMachine.isComplete());
return map;
}
@MessageExceptionHandler
@SendToUser(value = "/queue/errors", broadcast = false)