This commit is contained in:
nkorange 2019-03-18 20:03:08 +08:00
parent 7ec7311fc7
commit 3f2d704691

View File

@ -125,7 +125,19 @@ public class InstanceController {
String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME); String serviceName = WebUtils.required(request, CommonParams.SERVICE_NAME);
String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID); String namespaceId = WebUtils.optional(request, CommonParams.NAMESPACE_ID, Constants.DEFAULT_NAMESPACE_ID);
String agent = request.getHeader("Client-Version");
if (StringUtils.isBlank(agent)) {
agent = request.getHeader("User-Agent");
}
ClientInfo clientInfo = new ClientInfo(agent);
if (clientInfo.type == ClientInfo.ClientType.JAVA &&
clientInfo.version.compareTo(VersionUtil.parseVersion("1.0.0")) < 0) {
serviceManager.registerInstance(namespaceId, serviceName, parseInstance(request));
} else {
serviceManager.updateInstance(namespaceId, serviceName, parseInstance(request)); serviceManager.updateInstance(namespaceId, serviceName, parseInstance(request));
}
return "ok"; return "ok";
} }