Commit 149cc7d7 by Spencer Gibb

Implement ServiceInstance.{getUri,isSecure}

fixes gh-210
parent 043732ae
......@@ -16,11 +16,13 @@
package org.springframework.cloud.netflix.eureka;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
......@@ -63,6 +65,16 @@ public class EurekaDiscoveryClient implements DiscoveryClient {
public int getPort() {
return EurekaDiscoveryClient.this.config.getNonSecurePort();
}
@Override
public boolean isSecure() {
return EurekaDiscoveryClient.this.config.getSecurePortEnabled();
}
@Override
public URI getUri() {
return DefaultServiceInstance.getUri(this);
}
};
}
......@@ -98,6 +110,16 @@ public class EurekaDiscoveryClient implements DiscoveryClient {
public int getPort() {
return this.instance.getPort();
}
@Override
public boolean isSecure() {
return this.instance.isPortEnabled(InstanceInfo.PortType.SECURE);
}
@Override
public URI getUri() {
return DefaultServiceInstance.getUri(this);
}
}
@Override
......
......@@ -19,6 +19,7 @@ package org.springframework.cloud.netflix.ribbon;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerRequest;
......@@ -127,6 +128,16 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
return this.server.getPort();
}
@Override
public boolean isSecure() {
return false; //TODO: howto determine https from ribbon Server
}
@Override
public URI getUri() {
return DefaultServiceInstance.getUri(this);
}
public Server getServer() {
return this.server;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment