You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/02/13 14:31:27 UTC

[camel] branch camel-2.20.x updated (974a21b -> bc5a0a8)

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

davsclaus pushed a change to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 974a21b  CAMEL-12256 - AWS S3 Consumer does not return custom headers in S3 Headers
     new 3c08f0d  CAMEL-12222: RestSwaggerServlet - added option to suppress "translateContextPath"
     new bc5a0a8  CAMEL-12222: Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/swagger/servlet/RestSwaggerServlet.java  | 26 +++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 02/02: CAMEL-12222: Fixed CS

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit bc5a0a8db0b36d4f7a2dec1b3a8e21ac2abab552
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Feb 13 09:30:03 2018 -0500

    CAMEL-12222: Fixed CS
---
 .../camel/swagger/servlet/RestSwaggerServlet.java  | 26 ++++++++++------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
index 77ba9510..7198898 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
@@ -31,7 +31,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import io.swagger.jaxrs.config.BeanConfig;
-import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultClassResolver;
 import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.spi.RestConfiguration;
@@ -61,18 +60,6 @@ public class RestSwaggerServlet extends HttpServlet {
     private boolean apiContextIdListing;
     private boolean translateContextPath = true;
 
-
-    public boolean isTranslateContextPath() { return translateContextPath; }
-
-    /**
-     * Sets whether the context path of the request should be translated (true) or used as-is (false)
-     * Optional, Defaults to true
-     * @param translateContextPath
-     */
-    public void setTranslateContextPath(boolean translateContextPath) { this.translateContextPath = translateContextPath; }
-
-
-
     public String getApiContextIdPattern() {
         return apiContextIdPattern;
     }
@@ -100,6 +87,18 @@ public class RestSwaggerServlet extends HttpServlet {
         this.apiContextIdListing = apiContextIdListing;
     }
 
+    public boolean isTranslateContextPath() {
+        return translateContextPath;
+    }
+
+    /**
+     * Sets whether the context path of the request should be translated (true) or used as-is (false)
+     * Optional, Defaults to true
+     */
+    public void setTranslateContextPath(boolean translateContextPath) {
+        this.translateContextPath = translateContextPath;
+    }
+
     @Override
     public void init(final ServletConfig config) throws ServletException {
         super.init(config);
@@ -130,7 +129,6 @@ public class RestSwaggerServlet extends HttpServlet {
         if (translate != null) {
             translateContextPath = Boolean.valueOf(translate.toString());
         }
-
     }
 
     @Override

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.

[camel] 01/02: CAMEL-12222: RestSwaggerServlet - added option to suppress "translateContextPath"

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3c08f0d9ab457bd29655f2cc01644b300b152767
Author: realistTheorist <re...@gmail.com>
AuthorDate: Sun Feb 11 12:35:22 2018 -0500

    CAMEL-12222: RestSwaggerServlet - added option to suppress "translateContextPath"
---
 .../camel/swagger/servlet/RestSwaggerServlet.java  | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
index bc441a8..77ba9510 100644
--- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
+++ b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java
@@ -34,6 +34,7 @@ import io.swagger.jaxrs.config.BeanConfig;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultClassResolver;
 import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.swagger.RestApiResponseAdapter;
 import org.apache.camel.swagger.RestSwaggerSupport;
 import org.apache.camel.util.EndpointHelper;
@@ -58,6 +59,19 @@ public class RestSwaggerServlet extends HttpServlet {
 
     private String apiContextIdPattern;
     private boolean apiContextIdListing;
+    private boolean translateContextPath = true;
+
+
+    public boolean isTranslateContextPath() { return translateContextPath; }
+
+    /**
+     * Sets whether the context path of the request should be translated (true) or used as-is (false)
+     * Optional, Defaults to true
+     * @param translateContextPath
+     */
+    public void setTranslateContextPath(boolean translateContextPath) { this.translateContextPath = translateContextPath; }
+
+
 
     public String getApiContextIdPattern() {
         return apiContextIdPattern;
@@ -112,6 +126,11 @@ public class RestSwaggerServlet extends HttpServlet {
         if (listing != null) {
             apiContextIdListing = Boolean.valueOf(listing.toString());
         }
+        Object translate = parameters.remove("translateContextPath");
+        if (translate != null) {
+            translateContextPath = Boolean.valueOf(translate.toString());
+        }
+
     }
 
     @Override
@@ -189,7 +208,7 @@ public class RestSwaggerServlet extends HttpServlet {
                 if (!match) {
                     adapter.noContent();
                 } else {
-                    support.renderResourceListing(adapter, swaggerConfig, name, route, json, yaml, classResolver, null);
+                    support.renderResourceListing(adapter, swaggerConfig, name, route, json, yaml, classResolver, new RestConfiguration());
                 }
             }
         } catch (Exception e) {
@@ -226,6 +245,9 @@ public class RestSwaggerServlet extends HttpServlet {
      */
     private String translateContextPath(HttpServletRequest request) {
         String path = request.getContextPath();
+        if (!translateContextPath) {
+            return path;
+        }
         if (path.isEmpty() || path.equals("/")) {
             return "";
         } else {
@@ -237,4 +259,4 @@ public class RestSwaggerServlet extends HttpServlet {
         return path;
     }
 
-}
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.