tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1310113 - /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
Date Thu, 05 Apr 2012 22:35:27 GMT
Author: olamy
Date: Thu Apr  5 22:35:27 2012
New Revision: 1310113

URL: http://svn.apache.org/viewvc?rev=1310113&view=rev
Log:
[MTOMCAT-133] Servlet mapping to "/" does not work
use the defaut web.xml

Modified:
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java?rev=1310113&r1=1310112&r2=1310113&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java
Thu Apr  5 22:35:27 2012
@@ -19,12 +19,15 @@ package org.apache.tomcat.maven.plugin.t
  */
 
 import org.apache.catalina.Context;
+import org.apache.catalina.Host;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.loader.WebappLoader;
 import org.apache.catalina.realm.MemoryRealm;
 import org.apache.catalina.startup.Catalina;
 import org.apache.catalina.startup.CatalinaProperties;
+import org.apache.catalina.startup.ContextConfig;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.valves.AccessLogValve;
 import org.apache.maven.artifact.Artifact;
@@ -735,7 +738,33 @@ public abstract class AbstractRunMojo
                 // Trigger loading of catalina.properties
                 CatalinaProperties.getProperty( "foo" );
 
-                Tomcat embeddedTomcat = new Tomcat();
+                Tomcat embeddedTomcat = new Tomcat()
+                {
+                    public Context addWebapp( Host host, String url, String name, String
path )
+                    {
+
+                        Context ctx = new StandardContext();
+                        ctx.setName( name );
+                        ctx.setPath( url );
+                        ctx.setDocBase( path );
+
+                        ContextConfig ctxCfg = new ContextConfig();
+                        ctx.addLifecycleListener( ctxCfg );
+
+                        ctxCfg.setDefaultWebXml( new File( configurationDir, "conf/web.xml"
).getAbsolutePath() );
+
+                        if ( host == null )
+                        {
+                            getHost().addChild( ctx );
+                        }
+                        else
+                        {
+                            host.addChild( ctx );
+                        }
+
+                        return ctx;
+                    }
+                };
 
                 Context ctx = createContext( embeddedTomcat );
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message