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

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new ceaa88f378 Replace workaround with Armeria native supported context 
path (#12484)
ceaa88f378 is described below

commit ceaa88f378d40bedf40e40c33169b9804fc96aae
Author: kezhenxu94 <[email protected]>
AuthorDate: Sun Jul 28 21:35:38 2024 +0800

    Replace workaround with Armeria native supported context path (#12484)
---
 docs/en/changes/changes.md                                       | 1 +
 .../skywalking/oap/server/library/server/http/HTTPServer.java    | 9 +++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 7a6d526e80..b137a366d4 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -39,6 +39,7 @@
 * Fix Elasticsearch, MySQL, RabbitMQ dashboards typos and missing expressions.
 * BanyanDB: Zipkin Module set service as Entity for improving the query 
performance.
 * MQE: check the metrics value before do binary operation to improve 
robustness.
+* Replace workaround with Armeria native supported context path.
 
 #### UI
 
diff --git 
a/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java
 
b/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java
index d79a0899ee..5c787f673f 100644
--- 
a/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java
+++ 
b/oap-server/server-library/library-server/src/main/java/org/apache/skywalking/oap/server/library/server/http/HTTPServer.java
@@ -39,7 +39,6 @@ import java.util.List;
 import java.util.Set;
 
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.skywalking.oap.server.library.server.Server;
 import org.apache.skywalking.oap.server.library.server.ssl.PrivateKeyUtil;
 
@@ -58,11 +57,10 @@ public class HTTPServer implements Server {
 
     @Override
     public void initialize() {
-        // TODO replace prefix with real context path when Armeria supports it
-        final String contextPath = 
StringUtils.stripEnd(config.getContextPath(), "/");
         sb = com.linecorp.armeria.server.Server
             .builder()
-            .serviceUnder(contextPath + "/docs", DocService.builder().build())
+            .baseContextPath(config.getContextPath())
+            .serviceUnder("/docs", DocService.builder().build())
             .service("/internal/l7check", HealthCheckService.of())
             .workerGroup(config.getMaxThreads())
             .http1MaxHeaderSize(config.getMaxRequestHeaderSize())
@@ -99,7 +97,7 @@ public class HTTPServer implements Server {
             sb.absoluteUriTransformer(this::transformAbsoluteURI);
         }
 
-        log.info("Server root context path: {}", contextPath);
+        log.info("Server root context path: {}", config.getContextPath());
     }
 
     /**
@@ -114,7 +112,6 @@ public class HTTPServer implements Server {
         );
 
         sb.annotatedService()
-          .pathPrefix(config.getContextPath())
           .build(handler);
         this.allowedMethods.addAll(httpMethods);
     }

Reply via email to