@Configuration @EnableConfigurationProperties(value=ZipkinUiProperties.class) @ConditionalOnProperty(name="zipkin.ui.enabled", matchIfMissing=true) @RestController public class ZipkinUiAutoConfiguration extends org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
When looking at a trace, the browser is sent to the path "/traces/{id}". For the single-page app to serve that route, the server needs to forward the request to "/index.html". The same forwarding applies to "/dependencies" and any other routes the UI controls.
Under the scenes the JavaScript code looks at window.location to figure out what the
UI should do. This is handled by a route api defined in the crossroads library.
This includes a hard-coded cache policy, consistent with zipkin-scala.
| Constructor and Description |
|---|
ZipkinUiAutoConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
void |
addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) |
org.springframework.web.filter.CharacterEncodingFilter |
characterEncodingFilter()
This opts out of adding charset to png resources.
|
org.springframework.web.servlet.ModelAndView |
favicon()
Borrow favicon from UI assets under /zipkin
|
org.springframework.web.servlet.ModelAndView |
forwardApi(javax.servlet.http.HttpServletRequest request)
The UI looks for the api relative to where it is mounted, under /zipkin
|
org.springframework.web.servlet.ModelAndView |
forwardUiEndpoints()
This cherry-picks well-known routes the single-page app serves, and forwards to that as opposed
to returning a 404.
|
void |
redirectRoot(javax.servlet.http.HttpServletResponse response)
Make sure users who aren't familiar with /zipkin get to the right path
|
org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> |
serveIndex() |
org.springframework.http.ResponseEntity<ZipkinUiProperties> |
serveUiConfig() |
addArgumentResolvers, addCorsMappings, addFormatters, addInterceptors, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidatorpublic void addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry)
addResourceHandlers in interface org.springframework.web.servlet.config.annotation.WebMvcConfigureraddResourceHandlers in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter@Bean @Order(value=-2147483648) public org.springframework.web.filter.CharacterEncodingFilter characterEncodingFilter()
By default, CharacterEncodingFilter adds a charset qualifier to all resources, which helps, as javascript assets include extended character sets. However, the filter also adds charset to well-known binary ones like png. This creates confusing content types, such as "image/png;charset=UTF-8". See https://github.com/spring-projects/spring-boot/issues/5459
@RequestMapping(value="/zipkin/config.json",
method=GET)
public org.springframework.http.ResponseEntity<ZipkinUiProperties> serveUiConfig()
@RequestMapping(value="/zipkin/index.html",
method=GET)
public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> serveIndex()
@RequestMapping(value={"/zipkin/","/zipkin/traces/{id}","/zipkin/dependency"},
method=GET)
public org.springframework.web.servlet.ModelAndView forwardUiEndpoints()
@RequestMapping(value="/zipkin/api/**",
method=GET)
public org.springframework.web.servlet.ModelAndView forwardApi(javax.servlet.http.HttpServletRequest request)
@RequestMapping(value="/favicon.ico",
method=GET)
public org.springframework.web.servlet.ModelAndView favicon()
@RequestMapping(value="/",
method=GET)
public void redirectRoot(javax.servlet.http.HttpServletResponse response)
throws IOException
IOExceptionCopyright © 2015–2018 OpenZipkin. All rights reserved.