Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
8c691273
Commit
8c691273
authored
Jul 10, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.x'
parents
c1a81cfc
419bf0d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
ServletEndpointRegistrar.java
...k/boot/actuate/endpoint/web/ServletEndpointRegistrar.java
+13
-9
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java
View file @
8c691273
...
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
.
web
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
...
...
@@ -76,18 +77,21 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
EndpointServlet
endpointServlet
=
endpoint
.
getEndpointServlet
();
Dynamic
registration
=
servletContext
.
addServlet
(
name
,
endpointServlet
.
getServlet
());
registration
.
addMapping
(
getUrlMappings
(
endpoint
.
getRootPath
(),
name
));
String
[]
urlMappings
=
getUrlMappings
(
endpoint
.
getRootPath
());
registration
.
addMapping
(
urlMappings
);
if
(
logger
.
isInfoEnabled
())
{
Arrays
.
stream
(
urlMappings
).
forEach
(
(
mapping
)
->
logger
.
info
(
"Registered '"
+
mapping
+
"' to "
+
name
));
}
registration
.
setInitParameters
(
endpointServlet
.
getInitParameters
());
}
private
String
[]
getUrlMappings
(
String
endpointPath
,
String
name
)
{
return
this
.
basePaths
.
stream
().
map
((
basePath
)
->
(
basePath
!=
null
?
basePath
+
"/"
+
endpointPath
:
"/"
+
endpointPath
))
.
distinct
().
map
((
path
)
->
{
logger
.
info
(
"Registered '"
+
path
+
"' to "
+
name
);
return
(
path
.
endsWith
(
"/"
)
?
path
+
"*"
:
path
+
"/*"
);
}).
toArray
(
String
[]::
new
);
private
String
[]
getUrlMappings
(
String
endpointPath
)
{
return
this
.
basePaths
.
stream
()
.
map
((
basePath
)
->
(
basePath
!=
null
?
basePath
+
"/"
+
endpointPath
:
"/"
+
endpointPath
))
.
distinct
().
map
((
path
)
->
(
path
.
endsWith
(
"/"
)
?
path
+
"*"
:
path
+
"/*"
))
.
toArray
(
String
[]::
new
);
}
}
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