Add the static variable HTTP
authoryoubowu <wu.youbo@zte.com.cn>
Thu, 9 Mar 2017 12:51:50 +0000 (20:51 +0800)
committer6092002067 <wu.youbo@zte.com.cn>
Thu, 9 Mar 2017 12:51:50 +0000 (20:51 +0800)
Issue-ID: HOLMES-50

Change-Id: I4fad7c622f4aada0657f60063f38ce3f624611a2
Signed-off-by: youbowu <wu.youbo@zte.com.cn>
holmes-actions/src/main/java/org/openo/holmes/common/config/MicroServiceConfig.java
holmes-actions/src/main/java/org/openo/holmes/common/constant/AlarmConst.java
holmes-actions/src/main/java/org/openo/holmes/common/utils/MSBRegisterUtil.java

index 9c6ab3c..c17ad4a 100644 (file)
@@ -28,7 +28,7 @@ public class MicroServiceConfig {
     }\r
 \r
     public static String getMsbServerAddr() {\r
-        return getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT;\r
+        return AlarmConst.HTTP+getProperty("MSB_ADDR") + ":" + AlarmConst.MICRO_SERVICE_PORT;\r
     }\r
 \r
     public static String getServiceIp() {\r
index 40e15eb..9e83d4c 100644 (file)
@@ -36,4 +36,6 @@ public interface AlarmConst {
     int MICRO_SERVICE_STATUS_SUCCESS = 201;\r
 \r
     int MICRO_SERVICE_PORT = 8086;\r
+\r
+    String HTTP = "http://";\r
 }\r
index 5e806e4..9f66178 100644 (file)
@@ -40,7 +40,7 @@ public class MSBRegisterUtil {
         try {\r
             ObjectMapper mapper = new ObjectMapper();\r
             String content = mapper.writeValueAsString(entity);\r
-            HttpPost httpPost = new HttpPost("http://" + MicroServiceConfig.getMsbServerAddr()\r
+            HttpPost httpPost = new HttpPost(MicroServiceConfig.getMsbServerAddr()\r
                     + "/api/microservices/v1/services?createOrUpdate=false");\r
             if (StringUtils.isNotEmpty(content)) {\r
                 httpPost.setEntity(new ByteArrayEntity(content.getBytes()));\r