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
1366216b
Commit
1366216b
authored
Sep 05, 2013
by
Dave Syer
Committed by
Phillip Webb
Sep 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add X-Application-Context header to identify app
parent
2b1f6297
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
EndpointWebMvcAutoConfiguration.java
...ctuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
+22
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java
View file @
1366216b
...
...
@@ -16,7 +16,14 @@
package
org
.
springframework
.
boot
.
actuate
.
autoconfigure
;
import
java.io.IOException
;
import
javax.servlet.Filter
;
import
javax.servlet.FilterChain
;
import
javax.servlet.Servlet
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.BeanFactory
;
...
...
@@ -43,6 +50,7 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.event.ContextClosedEvent
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.web.filter.OncePerRequestFilter
;
import
org.springframework.web.servlet.DispatcherServlet
;
/**
...
...
@@ -100,6 +108,20 @@ public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
}
}
@Bean
public
Filter
applicationContextIdFilter
(
ApplicationContext
context
)
{
final
String
id
=
context
.
getId
();
return
new
OncePerRequestFilter
()
{
@Override
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
filterChain
)
throws
ServletException
,
IOException
{
response
.
addHeader
(
"X-Application-Context"
,
id
);
filterChain
.
doFilter
(
request
,
response
);
}
};
}
private
void
createChildManagementContext
()
{
final
AnnotationConfigEmbeddedWebApplicationContext
childContext
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
...
...
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