Commit ef092562 by Nepxion

修改成功返回信息

parent 2e01c90b
...@@ -84,7 +84,7 @@ public class AdminEndpoint extends AbstractMvcEndpoint { ...@@ -84,7 +84,7 @@ public class AdminEndpoint extends AbstractMvcEndpoint {
throw new PluginException("To input stream failed", e); throw new PluginException("To input stream failed", e);
} }
return "success"; return "Send config successfully";
} }
@RequestMapping(path = "view", method = RequestMethod.GET) @RequestMapping(path = "view", method = RequestMethod.GET)
...@@ -98,10 +98,10 @@ public class AdminEndpoint extends AbstractMvcEndpoint { ...@@ -98,10 +98,10 @@ public class AdminEndpoint extends AbstractMvcEndpoint {
return ruleEntity.getContent(); return ruleEntity.getContent();
} }
@RequestMapping(path = "status", method = RequestMethod.POST) @RequestMapping(path = "deregister", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ManagedOperation @ManagedOperation
public Object status(@RequestBody String status) { public Object deregister() {
Boolean discoveryControlEnabled = pluginContextAware.isDiscoveryControlEnabled(); Boolean discoveryControlEnabled = pluginContextAware.isDiscoveryControlEnabled();
if (!discoveryControlEnabled) { if (!discoveryControlEnabled) {
return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND); return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND);
...@@ -111,17 +111,17 @@ public class AdminEndpoint extends AbstractMvcEndpoint { ...@@ -111,17 +111,17 @@ public class AdminEndpoint extends AbstractMvcEndpoint {
throw new PluginException("No registration found"); throw new PluginException("No registration found");
} }
serviceRegistry.setStatus(registration, status); serviceRegistry.deregister(registration);
LOG.info("Set status for serviceId={} status={} successfully", registration.getServiceId(), status); LOG.info("Deregister for serviceId={} successfully", registration.getServiceId());
return "success"; return "Deregister successfully";
} }
@RequestMapping(path = "deregister", method = RequestMethod.POST) @RequestMapping(path = "status", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ManagedOperation @ManagedOperation
public Object deregister() { public Object status(@RequestBody String status) {
Boolean discoveryControlEnabled = pluginContextAware.isDiscoveryControlEnabled(); Boolean discoveryControlEnabled = pluginContextAware.isDiscoveryControlEnabled();
if (!discoveryControlEnabled) { if (!discoveryControlEnabled) {
return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND); return new ResponseEntity<>(Collections.singletonMap("Message", "Discovery control is disabled"), HttpStatus.NOT_FOUND);
...@@ -131,10 +131,10 @@ public class AdminEndpoint extends AbstractMvcEndpoint { ...@@ -131,10 +131,10 @@ public class AdminEndpoint extends AbstractMvcEndpoint {
throw new PluginException("No registration found"); throw new PluginException("No registration found");
} }
serviceRegistry.deregister(registration); serviceRegistry.setStatus(registration, status);
LOG.info("Deregister for serviceId={} successfully", registration.getServiceId()); LOG.info("Set status for serviceId={} status={} successfully", registration.getServiceId(), status);
return "success"; return "Set status successfully";
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment