camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anoordo...@apache.org
Subject [2/4] camel git commit: CAMEL-9638: implemented review notes
Date Fri, 24 Jun 2016 19:28:09 GMT
CAMEL-9638: implemented review notes


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

Branch: refs/heads/master
Commit: c9350c6fdcb8bd7dacd014180a8cd801c01a9f21
Parents: 3d84bbe
Author: Arno Noordover <anoordover@users.noreply.github.com>
Authored: Thu Jun 23 22:13:36 2016 +0200
Committer: Arno Noordover <anoordover@users.noreply.github.com>
Committed: Thu Jun 23 22:13:36 2016 +0200

----------------------------------------------------------------------
 .../camel/util/jsse/BaseSSLContextParameters.java       |  8 +++++---
 .../camel/util/jsse/SSLContextClientParameters.java     |  6 +++++-
 .../AbstractSSLContextClientParametersFactoryBean.java  |  6 +++---
 .../core/xml/util/jsse/SNIHostNamesDefinition.java      |  4 ++--
 .../apache/camel/component/http4/CamelHttp4Context.xml  | 12 ++++++------
 5 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c9350c6f/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
b/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
index a585fbe..cd1af45 100644
--- a/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
+++ b/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java
@@ -522,9 +522,11 @@ public abstract class BaseSSLContextParameters extends JsseParameters
{
             @Override
             public SSLSocket configure(SSLSocket socket) {
 
-                SSLParameters sslParameters = socket.getSSLParameters();
-                sslParameters.setServerNames(getSNIHostNames());
-                socket.setSSLParameters(sslParameters);
+                if (!getSNIHostNames().isEmpty()) {
+                    SSLParameters sslParameters = socket.getSSLParameters();
+                    sslParameters.setServerNames(getSNIHostNames());
+                    socket.setSSLParameters(sslParameters);
+                }
 
                 Collection<String> filteredCipherSuites = BaseSSLContextParameters.this
                     .filter(enabledCipherSuites, Arrays.asList(socket.getSSLParameters().getCipherSuites()),

http://git-wip-us.apache.org/repos/asf/camel/blob/c9350c6f/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
b/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
index a31fc21..0d48dbc 100644
--- a/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
+++ b/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java
@@ -39,12 +39,16 @@ public class SSLContextClientParameters extends BaseSSLContextParameters
{
 
     private List<SNIServerName> sniHostNames = new ArrayList<>();
 
-    public void setSniHostNames(List<String> sniHostNames) {
+    public void addAllSniHostNames(List<String> sniHostNames) {
         for (String sniHostName : sniHostNames) {
             this.sniHostNames.add(new SNIHostName(sniHostName));
         }
     }
 
+    public void setSniHostName(String sniHostName) {
+        this.sniHostNames.add(new SNIHostName(sniHostName));
+    }
+
     @Override
     protected List<SNIServerName> getSNIHostNames() {
         return sniHostNames;

http://git-wip-us.apache.org/repos/asf/camel/blob/c9350c6f/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextClientParametersFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextClientParametersFactoryBean.java
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextClientParametersFactoryBean.java
index 55b465a..5778264 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextClientParametersFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/AbstractSSLContextClientParametersFactoryBean.java
@@ -27,14 +27,14 @@ import org.apache.camel.util.jsse.SSLContextClientParameters;
 @XmlTransient
 public abstract class AbstractSSLContextClientParametersFactoryBean extends AbstractBaseSSLContextParametersFactoryBean<SSLContextClientParameters>
{
 
-    @XmlElement(name = "SNIHostNamesDefinition")
+    @XmlElement(name = "sniHostNames")
     private SNIHostNamesDefinition sniHostNamesDefinition;
 
     @Override
     protected SSLContextClientParameters createInstance() {
         SSLContextClientParameters newInstance = new SSLContextClientParameters();
         newInstance.setCamelContext(getCamelContext());
-        newInstance.setSniHostNames(sniHostNamesDefinition.getSniHostName());
+        newInstance.addAllSniHostNames(sniHostNamesDefinition.getSniHostName());
         return newInstance;
     }
 
@@ -43,7 +43,7 @@ public abstract class AbstractSSLContextClientParametersFactoryBean extends
Abst
         return SSLContextClientParameters.class;
     }
 
-    public org.apache.camel.core.xml.util.jsse.SNIHostNamesDefinition getSniHostNamesDefinition()
{
+    public SNIHostNamesDefinition getSniHostNamesDefinition() {
         return sniHostNamesDefinition;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c9350c6f/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SNIHostNamesDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SNIHostNamesDefinition.java
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SNIHostNamesDefinition.java
index 59f3d93..c7d663b 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SNIHostNamesDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/util/jsse/SNIHostNamesDefinition.java
@@ -24,10 +24,10 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "SNIHostNames", propOrder = {"sniHostName"})
+@XmlType(name = "sniHostNames", propOrder = {"sniHostName"})
 public class SNIHostNamesDefinition {
 
-    @XmlElement(name = "SNIHostName")
+    @XmlElement(name = "sniHostName")
     private List<String> sniHostName;
 
     public List<String> getSniHostName() {

http://git-wip-us.apache.org/repos/asf/camel/blob/c9350c6f/components/camel-http4/src/test/resources/org/apache/camel/component/http4/CamelHttp4Context.xml
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/test/resources/org/apache/camel/component/http4/CamelHttp4Context.xml
b/components/camel-http4/src/test/resources/org/apache/camel/component/http4/CamelHttp4Context.xml
index b51f2f9..221947b 100644
--- a/components/camel-http4/src/test/resources/org/apache/camel/component/http4/CamelHttp4Context.xml
+++ b/components/camel-http4/src/test/resources/org/apache/camel/component/http4/CamelHttp4Context.xml
@@ -28,9 +28,9 @@
 
   <camel:sslContextParameters id="correctSniSslContextParameters">
     <camel:clientParameters>
-      <camel:SNIHostNamesDefinition>
-        <camel:SNIHostName>www.mnot.net</camel:SNIHostName>
-      </camel:SNIHostNamesDefinition>
+      <camel:sniHostNames>
+        <camel:sniHostName>www.mnot.net</camel:sniHostName>
+      </camel:sniHostNames>
     </camel:clientParameters>
   </camel:sslContextParameters>
 
@@ -39,9 +39,9 @@
 
   <camel:sslContextParameters id="wrongSniSslContextParameters">
     <camel:clientParameters>
-      <camel:SNIHostNamesDefinition>
-        <camel:SNIHostName>blabla</camel:SNIHostName>
-      </camel:SNIHostNamesDefinition>
+      <camel:sniHostNames>
+        <camel:sniHostName>blabla</camel:sniHostName>
+      </camel:sniHostNames>
     </camel:clientParameters>
   </camel:sslContextParameters>
 


Mime
View raw message