提交 4598f454 编写于 作者: G Gao Hongtao 提交者: wu-sheng

Webapp/proxy (#1831)

* Remove backend service discovery

* Add undefined node icon

* Add undefined node icon

* Handle forward "/" to "index.html"
上级 0c6a784e
......@@ -22,7 +22,6 @@ 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.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.resource.PathResourceResolver;
......@@ -33,22 +32,22 @@ import org.springframework.web.servlet.resource.PathResourceResolver;
* @author gaohongtao
*/
@Configuration
@EnableWebMvc
public class MvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/**")
.addResourceLocations("classpath:/public/")
.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 || !resourcePath.startsWith("img/node")) {
if (raw != null) {
return raw;
}
Resource resource = location.createRelative("img/node/UNDEFINED.png");
Resource resource = location.createRelative("UNDEFINED.png");
if (!resource.exists() || !resource.isReadable()) {
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册