Support authorization in eureka.serviceUrl
This commit is contained in:
@@ -63,16 +63,30 @@ public class FizzEurekaServiceRegistration extends FizzServiceRegistration {
|
|||||||
for (String serviceUrl : eurekaServerServiceUrls) {
|
for (String serviceUrl : eurekaServerServiceUrls) {
|
||||||
String vip;
|
String vip;
|
||||||
int port;
|
int port;
|
||||||
int begin = serviceUrl.indexOf('p') + 4;
|
int at = serviceUrl.indexOf('@');
|
||||||
int colon = serviceUrl.indexOf(':', begin);
|
if (at > -1) {
|
||||||
if (colon > -1) {
|
int colon = serviceUrl.indexOf(':', at);
|
||||||
int end = serviceUrl.indexOf('/', colon);
|
if (colon > -1) {
|
||||||
vip = serviceUrl.substring(begin, colon);
|
int slash = serviceUrl.indexOf('/', colon);
|
||||||
port = Integer.parseInt(serviceUrl.substring(colon + 1, end));
|
vip = serviceUrl.substring(at + 1, colon);
|
||||||
|
port = Integer.parseInt(serviceUrl.substring(colon + 1, slash));
|
||||||
|
} else {
|
||||||
|
int slash = serviceUrl.indexOf('/', at);
|
||||||
|
vip = serviceUrl.substring(at + 1, slash);
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int end = serviceUrl.indexOf('/', begin);
|
int begin = serviceUrl.indexOf('/') + 2;
|
||||||
vip = serviceUrl.substring(begin, end);
|
int colon = serviceUrl.indexOf(':', begin);
|
||||||
port = 80;
|
if (colon > -1) {
|
||||||
|
int slash = serviceUrl.indexOf('/', colon);
|
||||||
|
vip = serviceUrl.substring(begin, colon);
|
||||||
|
port = Integer.parseInt(serviceUrl.substring(colon + 1, slash));
|
||||||
|
} else {
|
||||||
|
int slash = serviceUrl.indexOf('/', begin);
|
||||||
|
vip = serviceUrl.substring(begin, slash);
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
registryCenterVip2port.put(vip, port);
|
registryCenterVip2port.put(vip, port);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user