openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1765541 - in /openwebbeans/microwave/trunk/microwave-core/src: main/java/org/apache/microwave/Microwave.java test/java/org/apache/microwave/runner/CliTest.java
Date Wed, 19 Oct 2016 07:09:29 GMT
Author: rmannibucau
Date: Wed Oct 19 07:09:29 2016
New Revision: 1765541

URL: http://svn.apache.org/viewvc?rev=1765541&view=rev
Log:
avoid to create an uncontrolled forlder for the server

Modified:
    openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
    openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/runner/CliTest.java

Modified: openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java?rev=1765541&r1=1765540&r2=1765541&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
Wed Oct 19 07:09:29 2016
@@ -33,6 +33,7 @@ import org.apache.catalina.Server;
 import org.apache.catalina.Service;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.session.ManagerBase;
 import org.apache.catalina.session.StandardManager;
 import org.apache.catalina.startup.Catalina;
@@ -123,7 +124,7 @@ public class Microwave implements AutoCl
             throw new IllegalArgumentException("Already deployed: '" + context + "'");
         }
 
-        final Context ctx = new StandardContext();
+        final StandardContext ctx = new StandardContext();
         ctx.setPath(context);
         ctx.setName(context);
         try {
@@ -185,7 +186,6 @@ public class Microwave implements AutoCl
         } else {
             tomcat = new InternalTomcat();
         }
-        tomcat.getServer().setPort(configuration.stopPort);
 
         { // setup
             base = new File(getBaseDir());
@@ -224,6 +224,9 @@ public class Microwave implements AutoCl
         final File conf = new File(base, "conf");
         final File webapps = new File(base, "webapps");
 
+        tomcat.setBaseDir(base.getAbsolutePath());
+        tomcat.setHostname(configuration.host);
+
         final boolean initialized;
         if (configuration.serverXml != null) {
             final File file = new File(conf, "server.xml");
@@ -266,15 +269,23 @@ public class Microwave implements AutoCl
             tomcat.server(createServer(file.getAbsolutePath()));
             initialized = true;
         } else {
+            tomcat.getServer().setPort(configuration.stopPort);
             initialized = false;
         }
 
-        tomcat.setBaseDir(base.getAbsolutePath());
-        tomcat.setHostname(configuration.host);
         if (!initialized) {
-            tomcat.getHost().setAppBase(webapps.getAbsolutePath());
-            tomcat.getEngine().setDefaultHost(configuration.host);
             tomcat.setHostname(configuration.host);
+            tomcat.getEngine().setDefaultHost(configuration.host);
+            final StandardHost host = new StandardHost();
+            host.setName(configuration.host);
+            host.setAppBase(webapps.getAbsolutePath());
+            try {
+                host.setWorkDir(new File(base, "work").getCanonicalPath());
+            } catch (final IOException e) {
+                host.setWorkDir(new File(base, "work").getAbsolutePath());
+            }
+            tomcat.setHost(host);
+            tomcat.getEngine().addChild( host );
         }
 
         if (configuration.realm != null) {

Modified: openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/runner/CliTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/runner/CliTest.java?rev=1765541&r1=1765540&r2=1765541&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/runner/CliTest.java
(original)
+++ openwebbeans/microwave/trunk/microwave-core/src/test/java/org/apache/microwave/runner/CliTest.java
Wed Oct 19 07:09:29 2016
@@ -54,7 +54,8 @@ public class CliTest {
                 Cli.main(new String[]{
                         "--context=app",
                         "--stop=" + stop,
-                        "--http=" + http
+                        "--http=" + http,
+                        "--tmp-dir=target/CliTest/simple"
                 });
             }
         };



Mime
View raw message