diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java index a5daac881e..b79ac5ae82 100644 --- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java +++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/HttpServer.java @@ -19,6 +19,7 @@ import org.apache.eventmesh.admin.server.web.service.task.TaskBizService; import org.apache.eventmesh.common.remote.request.CreateTaskRequest; +import org.apache.eventmesh.common.utils.JsonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; @@ -27,18 +28,17 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import com.alibaba.druid.support.json.JSONUtils; - @RestController @RequestMapping("/eventmesh/admin") public class HttpServer { + @Autowired private TaskBizService taskService; @RequestMapping(value = "/createTask", method = RequestMethod.POST) public ResponseEntity createOrUpdateTask(@RequestBody CreateTaskRequest task) { String uuid = taskService.createTask(task); - return ResponseEntity.ok(JSONUtils.toJSONString(Response.success(uuid))); + return ResponseEntity.ok(JsonUtils.toJSONString(Response.success(uuid))); } public boolean deleteTask(Long id) { diff --git a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java index 329a00baae..d573c3bac4 100644 --- a/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java +++ b/eventmesh-admin-server/src/main/java/org/apache/eventmesh/admin/server/web/Response.java @@ -19,8 +19,15 @@ import org.apache.eventmesh.common.remote.exception.ErrorCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class Response { + private int code; + private boolean success; private String desc;