You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2015/04/02 05:16:20 UTC

camel git commit: CAMEL-8589 Fixed the url.getPort returning -1 issue of camel-swagger with thanks to Matthew.

Repository: camel
Updated Branches:
  refs/heads/master b3ebc297f -> 3f4a2f9e7


CAMEL-8589 Fixed the url.getPort returning -1 issue of camel-swagger with thanks to Matthew.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3f4a2f9e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3f4a2f9e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3f4a2f9e

Branch: refs/heads/master
Commit: 3f4a2f9e7f8d7ff296a879bd4bf872aa3bec9af3
Parents: b3ebc29
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Apr 2 10:55:49 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Apr 2 10:57:23 2015 +0800

----------------------------------------------------------------------
 .../component/swagger/RestSwaggerApiDeclarationServlet.scala     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3f4a2f9e/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
----------------------------------------------------------------------
diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
index 9057863..038f18f 100644
--- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
+++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala
@@ -108,7 +108,7 @@ abstract class RestSwaggerApiDeclarationServlet extends HttpServlet {
         base = ""
       }
       val path = translateContextPath(request)
-      if (url.getPort != 80) {
+      if (url.getPort != 80 && url.getPort != -1) {
         base = url.getProtocol + "://" + url.getHost + ":" + url.getPort + path + "/" + base
       } else {
         base = url.getProtocol + "://" + url.getHost + request.getContextPath + "/" + base
@@ -123,7 +123,7 @@ abstract class RestSwaggerApiDeclarationServlet extends HttpServlet {
         base = ""
       }
       val path = translateContextPath(request)
-      if (url.getPort != 80) {
+      if (url.getPort != 80 && url.getPort != -1) {
         base = url.getProtocol + "://" + url.getHost + ":" + url.getPort + path + "/" + base
       } else {
         base = url.getProtocol + "://" + url.getHost + request.getContextPath + "/" + base