Commit 35d02f75 by Dave Syer

Switch eureka endpoint to /eureka

All static content is excluded in the Jersey config, so we can use /eureka for the prefix to the Eureka API (i.e. /apps etc.) Fixes gh-44
parent cce52424
......@@ -41,7 +41,7 @@ public class Application {
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/api/
defaultZone: http://localhost:8761/eureka/
```
The default application name, virtual host and non-secure port are taken from the `Environment` is
......@@ -89,7 +89,7 @@ public class Application {
```
The server has a home page with a UI, and HTTP API endpoints per the
normal Eureka functionality under `/eureka/api/*`.
normal Eureka functionality under `/eureka/*`.
Eureka background reading: see https://github.com/cfregly/fluxcapacitor/wiki/NetflixOSS-FAQ#eureka-service-discovery-load-balancer[flux capacitor] and https://groups.google.com/forum/?fromgroups#!topic/eureka_netflix/g3p2r7gHnN0[google group discussion].
......
......@@ -35,7 +35,7 @@ import com.netflix.discovery.EurekaClientConfig;
@ConfigurationProperties("eureka.client")
public class EurekaClientConfigBean implements EurekaClientConfig {
public static final String DEFAULT_URL = "http://localhost:8761" + EurekaServerConfigBean.DEFAULT_PATH + "/";
public static final String DEFAULT_URL = "http://localhost:8761" + EurekaServerConfigBean.DEFAULT_PREFIX + "/";
public static final String DEFAULT_ZONE = "defaultZone";
......
......@@ -35,8 +35,6 @@ public class EurekaServerConfigBean implements EurekaServerConfig {
public static final String DEFAULT_PREFIX = "/eureka";
public static final String DEFAULT_PATH = DEFAULT_PREFIX + "/api";
private static final int MINUTES = 60 * 1000;
private String aWSAccessId;
......
package eurekademo;
import static org.junit.Assert.assertEquals;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = EurekaApplication.class)
@WebAppConfiguration
@IntegrationTest("server.port=0")
public class ApplicationTests {
@Value("${local.server.port}")
private int port = 0;
@Test
public void catalogLoads() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity("http://localhost:" + port + "/eureka/api/apps", Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
@Test
public void adminLoads() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity("http://localhost:" + port + "/env", Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
}
......@@ -131,7 +131,7 @@
</executions>
<configuration>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
<destinationFolder>${project.build.directory}/generated-resources/static/eureka/</destinationFolder>
<cssDestinationFolder>${project.build.directory}/generated-resources/static/eureka/css</cssDestinationFolder>
<wroFile>${project.build.directory}/wro/wro.xml</wroFile>
<extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
</configuration>
......
......@@ -32,10 +32,10 @@ public class EurekaServerConfiguration extends WebMvcConfigurerAdapter {
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new ServletContainer());
bean.setOrder(Ordered.LOWEST_PRECEDENCE);
bean.addInitParameter("com.sun.jersey.config.property.WebPageContentRegex", EurekaServerConfigBean.DEFAULT_PREFIX + "/(fonts|images|css)/.*");
bean.addInitParameter("com.sun.jersey.config.property.packages",
"com.netflix.discovery;com.netflix.eureka");
bean.addInitParameter("com.sun.jersey.config.feature.FilterContextPath", EurekaServerConfigBean.DEFAULT_PREFIX);
bean.setUrlPatterns(Lists.newArrayList(EurekaServerConfigBean.DEFAULT_PATH + "/*"));
bean.setUrlPatterns(Lists.newArrayList(EurekaServerConfigBean.DEFAULT_PREFIX + "/*"));
return bean;
}
......
......@@ -5,7 +5,7 @@
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<title>Eureka - Last N events</title>
<link rel="stylesheet" type="text/css" href="/eureka/wro.css">
<link rel="stylesheet" type="text/css" href="/eureka/css/wro.css">
</head>
<body id="three">
......
......@@ -11,7 +11,7 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/eureka/wro.css">
<link rel="stylesheet" href="/eureka/css/wro.css">
</head>
......
......@@ -43,7 +43,7 @@ public class ApplicationTests {
public void catalogLoads() {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + port + "/eureka/api/apps", Map.class);
"http://localhost:" + port + "/eureka/apps", Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
......
......@@ -40,8 +40,8 @@ eureka:
availabilityZones: default
#serviceUrl:
#default: http://localhost:8761/eureka/api/
#defaultZone: http://localhost:8761/eureka/api/
#default: http://localhost:8761/eureka/
#defaultZone: http://localhost:8761/eureka/
instance:
#Virtual host name by which the clients identifies this service
......
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