Update webapp to support rocketbot (#2526)

* Update webapp to support rocketbot

* Revert pom.xml
This commit is contained in:
Gao Hongtao 2019-04-26 10:26:17 +08:00 committed by 吴晟 Wu Sheng
parent 6db8859b11
commit 660943a23e
2 changed files with 23 additions and 32 deletions

View File

@ -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");
}
}

View File

@ -21,7 +21,10 @@ zuul:
ignoredServices: '*'
routes:
api:
path: /api/**
path: /graphql
serviceId: collector
login:
path: /login/account
serviceId: collector
collector: