Fix paths in /hystrix HTML pages
When running from /hystrix or from / (with a forward) the webjars and the monitor endpoint need to be resolvable, so we need to use the FTL macros again. Fixes gh-193
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
<#import "/spring.ftl" as spring />
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<base href="${basePath}">
|
||||
<base href="<@spring.url basePath/>">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Hystrix Dashboard</title>
|
||||
|
||||
<!-- Javascript to monitor and display -->
|
||||
<script src="webjars/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
|
||||
<script src="<@spring.url '/webjars/jquery/2.1.1/jquery.min.js'/>" type="text/javascript"></script>
|
||||
|
||||
<script>
|
||||
function sendToMonitor() {
|
||||
|
||||
if($('#stream').val().length > 0) {
|
||||
var url = "hystrix/monitor?stream=" + encodeURIComponent($('#stream').val()) + "";
|
||||
var url = "<@spring.url '/hystrix'/>/monitor?stream=" + encodeURIComponent($('#stream').val()) + "";
|
||||
if($('#delay').val().length > 0) {
|
||||
url += "&delay=" + $('#delay').val();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<#import "/spring.ftl" as spring />
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="${basePath}">
|
||||
<base href="<@spring.url basePath/>">
|
||||
<meta charset="utf-8" />
|
||||
<title>Hystrix Monitor</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
@@ -13,10 +14,10 @@
|
||||
<link rel="stylesheet" type="text/css" href="css/monitor.css" />
|
||||
|
||||
<!-- d3 -->
|
||||
<script type="text/javascript" src="../webjars/d3js/3.4.11/d3.min.js" ></script>
|
||||
<script type="text/javascript" src="<@spring.url '/webjars/d3js/3.4.11/d3.min.js'/>" ></script>
|
||||
|
||||
<!-- Javascript to monitor and display -->
|
||||
<script type="text/javascript" src="../webjars/jquery/2.1.1/jquery.min.js" ></script>
|
||||
<script type="text/javascript" src="<@spring.url '/webjars/jquery/2.1.1/jquery.min.js'/>" ></script>
|
||||
<script type="text/javascript" src="js/jquery.tinysort.min.js"></script>
|
||||
<script type="text/javascript" src="js/tmpl.js"></script>
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -50,7 +51,10 @@ public class HystrixDashboardTests {
|
||||
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.port + "/hystrix", String.class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
entity.getBody().contains("<base href=\"/\">");
|
||||
String body = entity.getBody();
|
||||
assertTrue(body.contains("<base href=\"/hystrix\">"));
|
||||
assertTrue(body.contains("\"/webjars"));
|
||||
assertTrue(body.contains("= \"/hystrix/monitor"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user