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