Merge: Better support client certificate authorization
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.catalina.start / src / main / java / org / springframework / osgi / web / tomcat / internal / Activator.java
index 9481f3158282293b52325071f5b96813aaa06aaf..17ed5e996e1bafe308c3548f8f5ecaed8ec6711d 100644 (file)
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.FileOutputStream;\r
 import java.io.IOException;\r
 import java.io.InputStream;\r
+import java.net.MalformedURLException;\r
 import java.net.URL;\r
 import java.net.URLConnection;\r
 import java.net.URLStreamHandler;\r
@@ -155,12 +156,20 @@ public class Activator implements BundleActivator {
                        throws Exception {\r
                URL xmlConfiguration = null;\r
 \r
-               if (System.getProperty(CatalinaActivator.ARGEO_SERVER_TOMCAT_CONFIG) != null)\r
-                       xmlConfiguration = new URL(\r
-                                       System.getProperty(CatalinaActivator.ARGEO_SERVER_TOMCAT_CONFIG));\r
-               else\r
+               if (System.getProperty(CatalinaActivator.ARGEO_SERVER_TOMCAT_CONFIG) != null) {\r
+                       String customConfig = System\r
+                                       .getProperty(CatalinaActivator.ARGEO_SERVER_TOMCAT_CONFIG);\r
+                       try {\r
+                               xmlConfiguration = new URL(customConfig);\r
+                       } catch (MalformedURLException e) {\r
+                               // within this bundle\r
+                               // typically 'default-server-ssl.xml'\r
+                               xmlConfiguration = bundle.getResource(customConfig);\r
+                       }\r
+               } else {\r
                        // fragment\r
                        xmlConfiguration = bundle.getResource(XML_CONF_LOCATION);\r
+               }\r
 \r
                if (xmlConfiguration != null) {\r
                        log.info("Using custom XML configuration " + xmlConfiguration);\r