[jboss-svn-commits] JBoss Common SVN: r4717 - in shrinkwrap/trunk/extension-tomcat/src: test/java/org/jboss/shrinkwrap/tomcat/test and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Jul 11 03:24:24 EDT 2010
Author: dan.j.allen
Date: 2010-07-11 03:24:24 -0400 (Sun, 11 Jul 2010)
New Revision: 4717
Modified:
shrinkwrap/trunk/extension-tomcat/src/main/java/org/jboss/shrinkwrap/tomcat/api/ShrinkWrapStandardContext.java
shrinkwrap/trunk/extension-tomcat/src/test/java/org/jboss/shrinkwrap/tomcat/test/TomcatDeploymentIntegrationUnitTestCase.java
Log:
SHRINKWRAP-198 change context path to begin with /, as required by Tomcat
don't overreach setting up StandardContext
optimize the container setup
Modified: shrinkwrap/trunk/extension-tomcat/src/main/java/org/jboss/shrinkwrap/tomcat/api/ShrinkWrapStandardContext.java
===================================================================
--- shrinkwrap/trunk/extension-tomcat/src/main/java/org/jboss/shrinkwrap/tomcat/api/ShrinkWrapStandardContext.java 2010-07-10 21:10:52 UTC (rev 4716)
+++ shrinkwrap/trunk/extension-tomcat/src/main/java/org/jboss/shrinkwrap/tomcat/api/ShrinkWrapStandardContext.java 2010-07-11 07:24:24 UTC (rev 4717)
@@ -90,6 +90,11 @@
}
}
+ /**
+ * /
+ */
+ private static final char ROOT = '/';
+
//-------------------------------------------------------------------------------------||
// Instance Members -------------------------------------------------------------------||
//-------------------------------------------------------------------------------------||
@@ -145,15 +150,12 @@
// Add the context
log.info("Webapp archive location: " + exported.getAbsolutePath());
this.setDocBase(exported.getAbsolutePath());
- // path should not begin with a / or else Tomcat fails to deploy the webapp properly
- this.setPath(baseName);
+ // context path must begin with a /
+ this.setPath(ROOT + baseName);
+ // we want to be as efficient as possible, so default to not unpack, save config or cache
this.setUnpackWAR(false);
- // QUESTION are we over-stepping the bounds w/ ContextConfig, StandardManager and work folder?
- ContextConfig config = new ContextConfig();
- ((Lifecycle) this).addLifecycleListener(config);
- this.setManager(new StandardManager());
- this.setWorkDir(new File(TMP_DIR, WORK_FOLDER).getAbsolutePath());
-
+ this.setSaveConfig(false);
+ this.setCachingAllowed(false);
// Remember the archive from which we're created
this.archive = archive;
}
Modified: shrinkwrap/trunk/extension-tomcat/src/test/java/org/jboss/shrinkwrap/tomcat/test/TomcatDeploymentIntegrationUnitTestCase.java
===================================================================
--- shrinkwrap/trunk/extension-tomcat/src/test/java/org/jboss/shrinkwrap/tomcat/test/TomcatDeploymentIntegrationUnitTestCase.java 2010-07-10 21:10:52 UTC (rev 4716)
+++ shrinkwrap/trunk/extension-tomcat/src/test/java/org/jboss/shrinkwrap/tomcat/test/TomcatDeploymentIntegrationUnitTestCase.java 2010-07-11 07:24:24 UTC (rev 4717)
@@ -30,6 +30,8 @@
import org.apache.catalina.Host;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.startup.ContextConfig;
import org.apache.catalina.startup.Embedded;
import org.apache.http.HttpEntity;
@@ -134,17 +136,19 @@
server.setName("tomcat");
Engine engine = server.createEngine();
engine.setName("tomcat");
- engine.setDefaultHost(HTTP_BIND_HOST + SEPARATOR);
+ engine.setDefaultHost(HTTP_BIND_HOST);
engine.setService(server);
server.setContainer(engine);
server.addEngine(engine);
- Host host = server.createHost(HTTP_BIND_HOST + SEPARATOR, System.getProperty("java.io.tmpdir"));
- host.setParent(engine);
+ StandardHost host = (StandardHost) server.createHost(HTTP_BIND_HOST, System.getProperty("java.io.tmpdir"));
+ host.setUnpackWARs(false);
+ host.setWorkDir("target/work");
engine.addChild(host);
Connector connector = server.createConnector(InetAddress.getByName(HTTP_BIND_HOST), HTTP_BIND_PORT, false);
server.addConnector(connector);
connector.setContainer(engine);
- //starts tomcat embedded
+
+ // starts embedded tomcat
server.init();
server.start();
@@ -154,7 +158,7 @@
// Deploy
final StandardContext context = archive.as(ShrinkWrapStandardContext.class);
- context.setParent(host);
+ context.addLifecycleListener(new ContextConfig());
host.addChild(context);
}
More information about the jboss-svn-commits
mailing list