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 2017/02/15 10:28:56 UTC

[2/2] camel git commit: CAMEL-10813: Host address in the rest configuration is now taken care of when creating a Restlet Server

CAMEL-10813: Host address in the rest configuration is now taken care of when creating a Restlet Server


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

Branch: refs/heads/camel-2.18.x
Commit: f376a01c8e231449fed3de2156d63ced64297b4c
Parents: 6ea18cb
Author: admin <ad...@test.com>
Authored: Wed Feb 15 15:37:20 2017 +0530
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Feb 15 11:28:50 2017 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/restlet/RestletComponent.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f376a01c/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index fdbca18..2ab533c 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -259,9 +259,15 @@ public class RestletComponent extends HeaderFilterStrategyComponent implements R
     }
 
     protected Server createServer(RestletEndpoint endpoint) {
-        return new Server(component.getContext().createChildContext(), Protocol.valueOf(endpoint.getProtocol()), endpoint.getPort());
+        // Consider hostname if provided. This is useful when loopback interface is required for security reasons.
+        if (endpoint.getHost() != null) {
+            return new Server(component.getContext().createChildContext(), Protocol.valueOf(endpoint.getProtocol()), endpoint.getHost(), endpoint.getPort(), null);
+        } else {
+            return new Server(component.getContext().createChildContext(), Protocol.valueOf(endpoint.getProtocol()), endpoint.getPort());
+        }
     }
 
+
     protected String stringArrayToString(String[] strings) {
         StringBuffer result = new StringBuffer();
         for (String str : strings) {