cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6960] Updates to the Swagger link at the services page
Date Mon, 25 Jul 2016 09:04:34 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 9fb6e0459 -> 6cfb72710


[CXF-6960] Updates to the Swagger link at the services page


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6cfb7271
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6cfb7271
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6cfb7271

Branch: refs/heads/master
Commit: 6cfb72710d74262f53354b43adcdffc13423e54c
Parents: 9fb6e04
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Jul 25 12:04:10 2016 +0300
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Jul 25 12:04:10 2016 +0300

----------------------------------------------------------------------
 .../src/main/release/samples/jax_rs/spring_boot/README    |  5 +++++
 .../samples/jax_rs/spring_boot_scan/application/README    |  5 +++++
 .../servlet/servicelist/FormattedServiceListWriter.java   | 10 +++++++++-
 3 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/6cfb7271/distribution/src/main/release/samples/jax_rs/spring_boot/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot/README b/distribution/src/main/release/samples/jax_rs/spring_boot/README
index 21c6e5b..7fdc9c1 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot/README
@@ -25,6 +25,11 @@ open the Swagger-UI page at
 
   http://localhost:8080/services/helloservice/api-docs?url=/services/helloservice/swagger.json
 
+or access it from the CXF Services page:
+
+  http://localhost:8080/services/helloservice/services
+  and follow a Swagger link.
+
 To run the client from a command line open a new terminal window and run:
 
 ----

http://git-wip-us.apache.org/repos/asf/cxf/blob/6cfb7271/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
index a054dc8..baeb48c 100644
--- a/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
+++ b/distribution/src/main/release/samples/jax_rs/spring_boot_scan/application/README
@@ -38,5 +38,10 @@ open the Swagger-UI page at
 
   http://localhost:8080/services/helloservice/api-docs?url=/services/helloservice/swagger.json
 
+or access it from the CXF Services page:
+
+  http://localhost:8080/services/helloservice/services
+  and follow a Swagger link.
+
 Check client/README on how to run a command line client.
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/6cfb7271/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
index 7bb75ae..0c25519 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/servicelist/FormattedServiceListWriter.java
@@ -20,6 +20,7 @@ package org.apache.cxf.transport.servlet.servicelist;
 
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.net.URI;
 import java.util.Map;
 
 import org.apache.cxf.Bus;
@@ -175,7 +176,14 @@ public class FormattedServiceListWriter implements ServiceListWriter
{
         if (bus != null && PropertyUtils.isTrue(bus.getProperty("swagger.service.description.available")))
{
             String swaggerPath = "swagger.json";
             if (PropertyUtils.isTrue(bus.getProperty("swagger.service.ui.available"))) {
-                swaggerPath = "api-docs?url=/" + swaggerPath;
+                URI uri = URI.create(absoluteURL);
+                String schemePath = uri.getScheme() + "://" + uri.getHost() 
+                    + (uri.getPort() == -1 ? "" : ":" + uri.getPort());
+                String relPath = absoluteURL.substring(schemePath.length());
+                if (!relPath.endsWith("/")) {
+                    relPath += "/";
+                }
+                swaggerPath = "api-docs?url=" + relPath + swaggerPath;
             }
             if (!absoluteURL.endsWith("/")) {
                 swaggerPath = "/" + swaggerPath;


Mime
View raw message