camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-10813: Host address in the rest configuration is now taken care of when creating a Restlet Server
Date Wed, 15 Feb 2017 10:28:55 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x 6ea18cb91 -> f376a01c8
  refs/heads/master bcb4ed25b -> bcf662da1


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/bcf662da
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bcf662da
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bcf662da

Branch: refs/heads/master
Commit: bcf662da1513aae9e9d1c0effece195347f28ef4
Parents: bcb4ed2
Author: admin <admin@test.com>
Authored: Wed Feb 15 15:37:20 2017 +0530
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Feb 15 11:27:40 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/bcf662da/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 0225e58..e7bd6f5 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
@@ -279,9 +279,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) {


Mime
View raw message