* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
import javax.ws.rs.client.Client;\r
import javax.ws.rs.client.ClientBuilder;\r
import javax.ws.rs.core.Response;\r
import javax.ws.rs.client.Client;\r
import javax.ws.rs.client.ClientBuilder;\r
import javax.ws.rs.core.Response;\r
public static String getMsbServerAddrWithHttpPrefix() {\r
String[] addrInfo = getMsbIpAndPort();\r
String ret = addrInfo[0] + ":" + addrInfo[1];\r
public static String getMsbServerAddrWithHttpPrefix() {\r
String[] addrInfo = getMsbIpAndPort();\r
String ret = addrInfo[0] + ":" + addrInfo[1];\r
String[] serviceAddrInfo = null;\r
String info = getServiceAddrInfoFromDcaeConsulByHostName(getEnv(HOSTNAME));\r
log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from Consul. The response is " + info + ".");\r
String[] serviceAddrInfo = null;\r
String info = getServiceAddrInfoFromDcaeConsulByHostName(getEnv(HOSTNAME));\r
log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from Consul. The response is " + info + ".");\r
ip = addr;\r
} else if (addr.lastIndexOf(":") < 5 && addr.indexOf("://") != -1) {\r
ip = addr.substring(addr.indexOf("//") + 2); //remove the http(s):// prefix\r
ip = addr;\r
} else if (addr.lastIndexOf(":") < 5 && addr.indexOf("://") != -1) {\r
ip = addr.substring(addr.indexOf("//") + 2); //remove the http(s):// prefix\r
ip = addr.substring(addr.indexOf("://") != -1 ? addr.indexOf("//") + 2 : 0, addr.lastIndexOf(":"));\r
port = addr.substring(addr.lastIndexOf(":") + 1);\r
}\r
ip = addr.substring(addr.indexOf("://") != -1 ? addr.indexOf("//") + 2 : 0, addr.lastIndexOf(":"));\r
port = addr.substring(addr.lastIndexOf(":") + 1);\r
}\r