You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2019/04/26 01:47:55 UTC

[skywalking] branch gao-webapp updated: Update webapp to support rocketbot

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch gao-webapp
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/gao-webapp by this push:
     new 773ea62  Update webapp to support rocketbot
773ea62 is described below

commit 773ea62fd767cffc69cfa0d295bd1306393f0dc9
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Fri Apr 26 09:46:47 2019 +0800

    Update webapp to support rocketbot
---
 apm-webapp/pom.xml                                 |  4 +-
 .../skywalking/apm/webapp/proxy/MvcConfig.java     | 50 ++++++++--------------
 apm-webapp/src/main/resources/application.yml      |  5 ++-
 3 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/apm-webapp/pom.xml b/apm-webapp/pom.xml
index adc0e5d..f08974e 100644
--- a/apm-webapp/pom.xml
+++ b/apm-webapp/pom.xml
@@ -166,13 +166,13 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <version>${spring.boot.version}</version>
-                <executions>
+                <!-- <executions>
                     <execution>
                         <goals>
                             <goal>repackage</goal>
                         </goals>
                     </execution>
-                </executions>
+                </executions> -->
             </plugin>
         </plugins>
     </build>
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 e3d1322..e01431a 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 7271314..c5acbfb 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: