You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2010/09/09 08:36:34 UTC

svn commit: r995326 - in /cxf/branches/2.2.x-fixes: ./ api/src/main/java/org/apache/cxf/configuration/jsse/ common/schemas/src/main/resources/schemas/configuration/ rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/ rt/transport...

Author: ffang
Date: Thu Sep  9 06:36:34 2010
New Revision: 995326

URL: http://svn.apache.org/viewvc?rev=995326&view=rev
Log:
Merged revisions 995314 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r995314 | ffang | 2010-09-09 13:29:44 +0800 (四, 09  9 2010) | 1 line
  
  [CXF-2976] Allow to configure SSL session cache size and TTL on the client
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java
    cxf/branches/2.2.x-fixes/common/schemas/src/main/resources/schemas/configuration/security.xsd
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSClientParametersConfig.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java?rev=995326&r1=995325&r2=995326&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java (original)
+++ cxf/branches/2.2.x-fixes/api/src/main/java/org/apache/cxf/configuration/jsse/TLSClientParameters.java Thu Sep  9 06:36:34 2010
@@ -28,6 +28,7 @@ import javax.net.ssl.SSLSocketFactory;
 public class TLSClientParameters extends TLSParameterBase {
     private boolean disableCNCheck;
     private SSLSocketFactory sslSocketFactory;
+    private int sslCacheTimeout = 86400000;
     private boolean useHttpsURLConnectionDefaultSslSocketFactory;
     private boolean useHttpsURLConnectionDefaultHostnameVerifier;
 
@@ -67,6 +68,21 @@ public class TLSClientParameters extends
     }
     
     /**
+     * Returns the SSL cache timeout if it has been configured or the JDK default value
+     */
+    public int getSslCacheTimeout() {
+        return sslCacheTimeout;
+    }
+
+    /**
+     * This sets the SSL Session Cache timeout value for client sessions handled by CXF
+     */
+    public void setSslCacheTimeout(int sslCacheTimeout) {
+        this.sslCacheTimeout = sslCacheTimeout;
+    }
+
+    
+    /**
      * Returns whether or not {@link javax.net.ssl.HttpsURLConnection#getDefaultSSLSocketFactory()} should be
      * used to create https connections. If <code>true</code> , {@link #getJsseProvider()} ,
      * {@link #getSecureSocketProtocol()}, {@link #getTrustManagers()}, {@link #getKeyManagers()},

Modified: cxf/branches/2.2.x-fixes/common/schemas/src/main/resources/schemas/configuration/security.xsd
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/schemas/src/main/resources/schemas/configuration/security.xsd?rev=995326&r1=995325&r2=995326&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/schemas/src/main/resources/schemas/configuration/security.xsd (original)
+++ cxf/branches/2.2.x-fixes/common/schemas/src/main/resources/schemas/configuration/security.xsd Thu Sep  9 06:36:34 2010
@@ -479,6 +479,13 @@
                 </xs:documentation>
               </xs:annotation>
            </xs:attribute>
+           <xs:attribute name="sslCacheTimeout" type="xs:int">
+            <xs:annotation>
+                <xs:documentation>
+                    This attribute contains the JDK SSL session cache timeout
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
     </xs:complexType>
     
     <xs:complexType name="TLSServerParametersType">

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSClientParametersConfig.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSClientParametersConfig.java?rev=995326&r1=995325&r2=995326&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSClientParametersConfig.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/configuration/jsse/spring/TLSClientParametersConfig.java Thu Sep  9 06:36:34 2010
@@ -100,6 +100,9 @@ public final class TLSClientParametersCo
         if (params.isSetCertConstraints()) {
             ret.setCertConstraints(params.getCertConstraints());
         }
+        if (params.isSetSslCacheTimeout()) {
+            ret.setSslCacheTimeout(params.getSslCacheTimeout());
+        }
         return ret;
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java?rev=995326&r1=995325&r2=995326&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java (original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java Thu Sep  9 06:36:34 2010
@@ -171,7 +171,7 @@ public final class HttpsURLConnectionFac
 
             SSLContext ctx = provider == null ? SSLContext.getInstance(protocol) : SSLContext
                 .getInstance(protocol, provider);
-
+            ctx.getClientSessionContext().setSessionTimeout(tlsClientParameters.getSslCacheTimeout());
             ctx.init(tlsClientParameters.getKeyManagers(), tlsClientParameters.getTrustManagers(),
                      tlsClientParameters.getSecureRandom());