Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
2d8085cc
Commit
2d8085cc
authored
Feb 10, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the base href of the hystrix dashboard pages
fixes gh-204
parent
24a06ca6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
5 deletions
+24
-5
HystrixDashboardController.java
...netflix/hystrix/dashboard/HystrixDashboardController.java
+1
-1
index.ftl
...-dashboard/src/main/resources/templates/hystrix/index.ftl
+1
-1
monitor.ftl
...ashboard/src/main/resources/templates/hystrix/monitor.ftl
+1
-1
HystrixDashboardContextTests.java
...tflix/hystrix/dashboard/HystrixDashboardContextTests.java
+19
-2
HystrixDashboardTests.java
...loud/netflix/hystrix/dashboard/HystrixDashboardTests.java
+2
-0
No files found.
spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardController.java
View file @
2d8085cc
...
...
@@ -44,7 +44,7 @@ public class HystrixDashboardController {
private
String
extractPath
(
WebRequest
request
)
{
String
path
=
request
.
getContextPath
()
+
(
String
)
request
.
getAttribute
(
"org.springframework."
+
request
.
getAttribute
(
"org.springframework."
+
"web.servlet.HandlerMapping.pathWithinHandlerMapping"
,
RequestAttributes
.
SCOPE_REQUEST
);
return
path
;
...
...
spring-cloud-netflix-hystrix-dashboard/src/main/resources/templates/hystrix/index.ftl
View file @
2d8085cc
...
...
@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base
href=
"
<@spring.url basePath/>
"
>
<base
href=
"
${basePath}
"
>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=ISO-8859-1"
>
<title>
Hystrix Dashboard
</title>
...
...
spring-cloud-netflix-hystrix-dashboard/src/main/resources/templates/hystrix/monitor.ftl
View file @
2d8085cc
...
...
@@ -2,7 +2,7 @@
<!doctype html>
<html
lang=
"en"
>
<head>
<base
href=
"<@spring.url basePath/>
"
>
<base
href=
"${basePath}
"
>
<meta
charset=
"utf-8"
/>
<title>
Hystrix Monitor
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
...
...
spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardContextTests.java
View file @
2d8085cc
...
...
@@ -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
...
...
@@ -44,6 +45,7 @@ import static org.junit.Assert.assertEquals;
"server.contextPath=/context"
})
public
class
HystrixDashboardContextTests
{
public
static
final
String
JQUERY_PATH
=
"/context/webjars/jquery/2.1.1/jquery.min.js"
;
@Value
(
"${local.server.port}"
)
private
int
port
=
0
;
...
...
@@ -52,6 +54,19 @@ public class HystrixDashboardContextTests {
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
().
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/context/hystrix"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
String
body
=
entity
.
getBody
();
assertTrue
(
"wrong base path rendered in template"
,
body
.
contains
(
"base href=\"/context/hystrix\""
));
}
@Test
public
void
correctJavascriptLink
()
{
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
().
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/context/hystrix"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
String
body
=
entity
.
getBody
();
assertTrue
(
"wrong jquery path rendered in template"
,
body
.
contains
(
"src=\""
+
JQUERY_PATH
+
"\""
));
}
@Test
...
...
@@ -65,8 +80,7 @@ public class HystrixDashboardContextTests {
@Test
public
void
webjarsAvailable
()
{
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
().
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/context/webjars/jquery/2.1.1/jquery.min.js"
,
String
.
class
);
"http://localhost:"
+
this
.
port
+
JQUERY_PATH
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
}
...
...
@@ -76,6 +90,9 @@ public class HystrixDashboardContextTests {
"http://localhost:"
+
this
.
port
+
"/context/hystrix/monitor"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
String
body
=
entity
.
getBody
();
assertTrue
(
"wrong base path rendered in template"
,
body
.
contains
(
"base href=\"/context/hystrix/monitor\""
));
}
@Configuration
...
...
spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardTests.java
View file @
2d8085cc
...
...
@@ -71,6 +71,8 @@ public class HystrixDashboardTests {
ResponseEntity
<
String
>
entity
=
new
TestRestTemplate
().
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/hystrix/monitor"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
entity
.
getStatusCode
());
String
body
=
entity
.
getBody
();
assertTrue
(
body
.
contains
(
"<base href=\"/hystrix/monitor\">"
));
}
@Configuration
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment