diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java index e3d1322a1..e01431abd 100644 --- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java +++ b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/proxy/MvcConfig.java @@ -18,49 +18,37 @@ package org.apache.skywalking.apm.webapp.proxy; -import java.io.IOException; -import java.util.Arrays; import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.Resource; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.resource.PathResourceResolver; /** * Additional MVC Configuration. - * + * * @author gaohongtao */ @Configuration public class MvcConfig extends WebMvcConfigurerAdapter { - + @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { registry - .addResourceHandler("/img/node/**") - .addResourceLocations("classpath:/public/img/node/") - .setCachePeriod(3600) - .resourceChain(true) - .addResolver(new PathResourceResolver() { - @Override protected Resource getResource(String resourcePath, Resource location) throws IOException { - Resource raw = super.getResource(resourcePath, location); - if (raw != null) { - return raw; - } - Resource resource = location.createRelative("UNDEFINED.png"); - if (!resource.exists() || !resource.isReadable()) { - return null; - } - if (this.checkResource(resource, location)) { - return resource; - } - - if (this.logger.isTraceEnabled()) { - Resource[] allowedLocations = this.getAllowedLocations(); - this.logger.trace("Resource path \"" + resourcePath + "\" was successfully resolved but resource \"" + resource.getURL() + "\" is neither under the current location \"" + location.getURL() + "\" nor under any of the allowed locations " + (allowedLocations != null ? Arrays.asList(allowedLocations) : "[]")); - } - return null; - } - }); + .addResourceHandler("/index.html") + .addResourceLocations("classpath:/public/index.html"); + registry + .addResourceHandler("/css/**") + .addResourceLocations("classpath:/public/css/"); + registry + .addResourceHandler("/img/**") + .addResourceLocations("classpath:/public/img/"); + registry + .addResourceHandler("/js/**") + .addResourceLocations("classpath:/public/js/"); + registry + .addResourceHandler("/favicon.ico") + .addResourceLocations("classpath:/public/favicon.ico"); + registry + .addResourceHandler("/logo.png") + .addResourceLocations("classpath:/public/logo.png"); } } \ No newline at end of file diff --git a/apm-webapp/src/main/resources/application.yml b/apm-webapp/src/main/resources/application.yml index 727131444..c5acbfb59 100644 --- a/apm-webapp/src/main/resources/application.yml +++ b/apm-webapp/src/main/resources/application.yml @@ -21,7 +21,10 @@ zuul: ignoredServices: '*' routes: api: - path: /api/** + path: /graphql + serviceId: collector + login: + path: /login/account serviceId: collector collector: