diff options
author | 6092002067 <wu.youbo@zte.com.cn> | 2017-03-14 10:35:49 +0800 |
---|---|---|
committer | 6092002067 <wu.youbo@zte.com.cn> | 2017-03-14 10:35:49 +0800 |
commit | 3f7413a52908cc06c4a0b91df6f9a219a06ff11d (patch) | |
tree | 90cf3fb9ca636bae4d16915a9993d7e660c32616 | |
parent | 6a7626d342add433d1c58ee369cf4c54f191ad43 (diff) |
Change the Way to Invoke HTTP Requests
Change-Id: Iab30237b7d535600fef0912b04f73179a901c98a
Issue-ID: HOLMES-50
Signed-off-by: youbowu <wu.youbo@zte.com.cn>
-rw-r--r-- | rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java b/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java index ac381d1..e792fbf 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java +++ b/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineService.java @@ -26,6 +26,7 @@ import javax.ws.rs.core.Response; import lombok.extern.slf4j.Slf4j;
import org.glassfish.jersey.client.ClientConfig;
import org.jvnet.hk2.annotations.Service;
+import org.openo.holmes.common.config.MicroServiceConfig;
import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;
import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;
import org.openo.holmes.rulemgt.constant.RuleMgtConstant;
@@ -34,11 +35,10 @@ import org.openo.holmes.rulemgt.constant.RuleMgtConstant; @Service
public class EngineService {
- String url = "http://10.250.0.3:9102";
-
protected Response delete(String packageName) throws IOException {
Client client = createClient();
- WebTarget webTarget = client.target(url + RuleMgtConstant.ENGINE_PATH + "/" + packageName);
+ WebTarget webTarget = client
+ .target(MicroServiceConfig.getMsbServerAddr() + RuleMgtConstant.ENGINE_PATH + "/" + packageName);
return webTarget.request(MediaType.APPLICATION_JSON).delete();
}
@@ -52,7 +52,7 @@ public class EngineService { Client client = createClient();
ObjectMapper mapper = new ObjectMapper();
String content = mapper.writeValueAsString(correlationCheckRule4Engine);
- WebTarget webTarget = client.target(url + RuleMgtConstant.ENGINE_PATH);
+ WebTarget webTarget = client.target(MicroServiceConfig.getMsbServerAddr() + RuleMgtConstant.ENGINE_PATH);
return webTarget.request(MediaType.APPLICATION_JSON).post(Entity.entity(content, MediaType.APPLICATION_JSON));
}
@@ -60,7 +60,7 @@ public class EngineService { Client client = createClient();
ObjectMapper mapper = new ObjectMapper();
String content = mapper.writeValueAsString(correlationDeployRule4Engine);
- WebTarget webTarget = client.target(url + RuleMgtConstant.ENGINE_PATH);
+ WebTarget webTarget = client.target(MicroServiceConfig.getMsbServerAddr() + RuleMgtConstant.ENGINE_PATH);
return webTarget.request(MediaType.APPLICATION_JSON).put(Entity.entity(content, MediaType.APPLICATION_JSON));
}
}
|