@Configuration @EnableConfigurationProperties(value=ZipkinUiProperties.class) @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 |
forwardUiEndpoints(org.springframework.ui.ModelMap model)
This cherry-picks well-known routes the single-page app serves, and forwards to that as opposed
to returning a 404.
|
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, 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="/config.json",
method=GET,
produces="application/json")
public org.springframework.http.ResponseEntity<ZipkinUiProperties> serveUiConfig()
@RequestMapping(value="/index.html",
method=GET)
public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> serveIndex()
@RequestMapping(value={"/","/traces/{id}","/dependency"},
method=GET)
public org.springframework.web.servlet.ModelAndView forwardUiEndpoints(org.springframework.ui.ModelMap model)
Copyright © 2015–2016 OpenZipkin. All rights reserved.