geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r815343 - in /geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector: AbstractHttp11ConnectorGBean.java BaseHttp11ConnectorGBean.java Http11APRConnectorGBean.java
Date Tue, 15 Sep 2009 14:25:20 GMT
Author: genspring
Date: Tue Sep 15 14:25:19 2009
New Revision: 815343

URL: http://svn.apache.org/viewvc?rev=815343&view=rev
Log:
GERONIMO-4877 Modification to keystoreFile doesn't work for HTTPS connector

Modified:
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java?rev=815343&r1=815342&r2=815343&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java
(original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java
Tue Sep 15 14:25:19 2009
@@ -63,6 +63,10 @@
     
     // Generic SSL
     public String getAlgorithm() {
+        
+        if ("default".equalsIgnoreCase(algorithm)) {
+            return KeyManagerFactory.getDefaultAlgorithm();
+        }
         return algorithm;
     }
 
@@ -83,10 +87,7 @@
 
         String keystore = (String) connector.getAttribute("keystoreFile");
         
-        if (keystore.indexOf(System.getProperty("catalina.home")) !=-1)
-            return keystore.substring(System.getProperty("catalina.home").length()+1, keystore.length());
-        else
-            return keystore;
+        return getRelatedPathtoCatalinaHome(keystore);
 
     }
 
@@ -99,7 +100,11 @@
     }
 
     public String getTruststoreFile() {
-        return truststoreFileName;
+        
+        String truststoreFile = (String) connector.getAttribute("truststoreFile");
+        
+        return getRelatedPathtoCatalinaHome(truststoreFile);
+
     }
 
     public String getTruststoreType() {
@@ -142,15 +147,26 @@
 
     @Persistent(manageable=false)
     public void setKeystoreFile(String keystoreFile) {
-       /* if (keystoreFile!= null && keystoreFile.equals("")) 
+        if (keystoreFile!= null && keystoreFile.equals("")) 
             keystoreFile = null;
+        
         keystoreFileName = keystoreFile;
-        if (keystoreFileName == null)
-            connector.setAttribute("keystoreFile", null);
-        else
-            connector.setAttribute("keystoreFile", serverInfo.resolveServerPath(keystoreFileName));
-        */
+        
+        if (keystoreFileName == null) {
+
+            connector.setAttribute("keystoreFile", keystoreFileName);
+
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(keystoreFileName);
+            
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("keystoreFile", resovledAbsolutePath);
+
+        }
+        
     }
+    
 
     @Persistent(manageable=false)
     public void setKeystorePass(String keystorePass) {
@@ -178,10 +194,19 @@
         if (truststoreFile!= null && truststoreFile.equals("")) 
             truststoreFile = null;
         truststoreFileName = truststoreFile;
-        if (truststoreFileName == null)
+        
+        if (truststoreFileName == null) {
             connector.setAttribute("truststoreFile", null);
-        else
-            connector.setAttribute("truststoreFile", serverInfo.resolveServerPath(truststoreFileName));
+        }
+
+        else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(truststoreFile);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("truststoreFile", resovledAbsolutePath);
+        }
+
     }
     
     @Persistent(manageable=false)

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java?rev=815343&r1=815342&r2=815343&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java
(original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java
Tue Sep 15 14:25:19 2009
@@ -18,6 +18,7 @@
  */
 package org.apache.geronimo.tomcat.connector;
 
+import java.io.File;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
@@ -366,6 +367,33 @@
     public void resetStats() {
         reset = true;
     }
+    
+    protected String getRelatedPathtoCatalinaHome(String path) {
+
+        if (null != path && path.indexOf(System.getProperty("catalina.home")) !=
-1) {
+            return path.substring(System.getProperty("catalina.home").length() + 1, path.length());
+        } else {
+            return path;
+        }
+    }
+
+    protected String getAbsolutePathBasedOnCatalinaHome(String path) {
+
+        if (path == null) {
+            return path;
+        }
+
+        if (new File(path).isAbsolute()) {
+            return path;
+        }
+      
+        
+        File file= new File(new File(System.getProperty("catalina.home")), path);
+
+        return file.getAbsolutePath();
+        
+
+    }
 
     
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java?rev=815343&r1=815342&r2=815343&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java
(original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java
Tue Sep 15 14:25:19 2009
@@ -77,23 +77,28 @@
     }
 
     public String getSslCACertificateFile() {
-        return caCertificateFile;
+        String path = (String) connector.getAttribute("SSLCACertificateFile");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslCACertificatePath() {
-        return caCertificatePath;
+        String path = (String) connector.getAttribute("SSLCACertificatePath");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslCertificateChainFile() {
-        return certificateChainFile; 
+        String path = (String) connector.getAttribute("truststoreFile");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslCertificateFile() {
-        return certificateFile; 
+        String path = (String) connector.getAttribute("SSLCertificateFile");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslCertificateKeyFile() {
-        return certificateKeyFile; 
+        String path = (String) connector.getAttribute("SSLCertificateKeyFile");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslCipherSuite() {
@@ -105,11 +110,13 @@
     }
 
     public String getSslCARevocationFile() {
-        return revocationFile;
+        String path = (String) connector.getAttribute("SSLCARevocationFile");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslCARevocationPath() {
-        return revocationPath;
+        String path = (String) connector.getAttribute("SSLCARevocationPath");
+        return getRelatedPathtoCatalinaHome(path);
     }
 
     public String getSslVerifyClient() {
@@ -150,10 +157,17 @@
         if (sslCACertificateFile != null && sslCACertificateFile.equals(""))
             sslCACertificateFile = null;
         caCertificateFile = sslCACertificateFile;
-        if (caCertificateFile == null)
+        
+        if (caCertificateFile == null) {
             connector.setAttribute("SSLCACertificateFile", null);
-        else
-            connector.setAttribute("SSLCACertificateFile", serverInfo.resolveServerPath(caCertificateFile));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(caCertificateFile);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCACertificateFile", resovledAbsolutePath);
+
+        }
     }
     
     @Persistent(manageable=false)
@@ -161,10 +175,17 @@
         if (sslCACertificatePath != null && sslCACertificatePath.equals(""))
             sslCACertificatePath = null;
         caCertificatePath = sslCACertificatePath;
-        if (caCertificatePath == null)
+        
+        if (caCertificatePath == null) {
             connector.setAttribute("SSLCACertificatePath", null);
-        else
-            connector.setAttribute("SSLCACertificatePath", serverInfo.resolveServerPath(caCertificatePath));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(caCertificatePath);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCACertificatePath", resovledAbsolutePath);
+
+        }
     }
     
     @Persistent(manageable=false)
@@ -172,10 +193,17 @@
         if (sslCertificateChainFile != null && sslCertificateChainFile.equals(""))
             sslCertificateChainFile = null;
         certificateChainFile = sslCertificateChainFile;
-        if (certificateChainFile == null)
+        
+        if (certificateChainFile == null) {
             connector.setAttribute("SSLCertificateChainFile", null);
-        else
-            connector.setAttribute("SSLCertificateChainFile", serverInfo.resolveServerPath(certificateChainFile));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(certificateChainFile);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCertificateChainFile", resovledAbsolutePath);
+
+        }
     }
     
     @Persistent(manageable=false)
@@ -183,10 +211,17 @@
         if (sslCertificateFile != null && sslCertificateFile.equals(""))
             sslCertificateFile = null;
         certificateFile = sslCertificateFile;
-        if (certificateFile == null)
+        
+        if (certificateFile == null) {
             connector.setAttribute("SSLCertificateFile", null);
-        else
-            connector.setAttribute("SSLCertificateFile", serverInfo.resolveServerPath(certificateFile));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(certificateFile);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCertificateFile", resovledAbsolutePath);
+
+        }
     }
     
     @Persistent(manageable=false)
@@ -194,10 +229,17 @@
         if (sslCertificateKeyFile != null && sslCertificateKeyFile.equals(""))
             sslCertificateKeyFile = null;
         certificateKeyFile = sslCertificateKeyFile;
-        if (certificateKeyFile == null)
+        
+        if (certificateKeyFile == null) {
             connector.setAttribute("SSLCertificateKeyFile", null);
-        else
-            connector.setAttribute("SSLCertificateKeyFile", serverInfo.resolveServerPath(certificateKeyFile));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(certificateKeyFile);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCertificateKeyFile", resovledAbsolutePath);
+
+        }
     }
     
     @Persistent(manageable=false)
@@ -222,10 +264,17 @@
         if (sslCARevocationFile!= null && sslCARevocationFile.equals("")) 
             sslCARevocationFile = null;
         revocationFile = sslCARevocationFile;
-        if (revocationFile == null)
+        
+        if (revocationFile == null) {
             connector.setAttribute("SSLCARevocationFile", null);
-        else
-            connector.setAttribute("SSLCARevocationFile", serverInfo.resolveServerPath(revocationFile));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(revocationFile);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCARevocationFile", resovledAbsolutePath);
+
+        }
     }
     
     @Persistent(manageable=false)
@@ -233,10 +282,17 @@
         if (sslCARevocationPath!= null && sslCARevocationPath.equals("")) 
             sslCARevocationPath = null;
         revocationPath = sslCARevocationPath;
-        if (revocationPath == null)
+        
+        if (revocationPath == null) {
             connector.setAttribute("SSLCARevocationPath", null);
-        else
-            connector.setAttribute("SSLCARevocationPath", serverInfo.resolveServerPath(revocationPath));
+        } else {
+
+            String resovledAbsolutePath = this.getAbsolutePathBasedOnCatalinaHome(revocationPath);
+
+            if (resovledAbsolutePath != null)
+                connector.setAttribute("SSLCARevocationPath", resovledAbsolutePath);
+
+        }
 
     }
     



Mime
View raw message