You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/05/19 08:47:20 UTC

svn commit: r539698 - in /incubator/tuscany/branches/sca-java-0.90: modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/ samples/calculator-web/src/main/resources/META-INF/ samples/calculator-web/src/main/webapp/META-INF/ samples/helloworld...

Author: lresende
Date: Fri May 18 23:47:19 2007
New Revision: 539698

URL: http://svn.apache.org/viewvc?view=rev&rev=539698
Log:
Merging fix for web-apps to store the sca-contribution.xml on the proper location (root of the war file\META-INF). 
Also had to change host-webapp in order to properly find the contribution root

Added:
    incubator/tuscany/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/META-INF/
      - copied from r539690, incubator/tuscany/branches/sca-java-0.90/samples/calculator-web/src/main/resources/META-INF/
    incubator/tuscany/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/META-INF/
      - copied from r539690, incubator/tuscany/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/resources/META-INF/
Removed:
    incubator/tuscany/branches/sca-java-0.90/samples/calculator-web/src/main/resources/META-INF/
    incubator/tuscany/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/resources/META-INF/
Modified:
    incubator/tuscany/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java

Modified: incubator/tuscany/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java?view=diff&rev=539698&r1=539697&r2=539698
==============================================================================
--- incubator/tuscany/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java (original)
+++ incubator/tuscany/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java Fri May 18 23:47:19 2007
@@ -19,6 +19,10 @@
 
 package org.apache.tuscany.sca.webapp;
 
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
 import javax.servlet.ServletContext;
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
@@ -36,8 +40,27 @@
      */
     public static SCADomain initSCADomain(ServletContext servletContext) {
         SCADomain scaDomain = (SCADomain)servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE);
+        
+        String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
+        String contributionRoot = null;
+        
+        try {
+            URL rootURL = servletContext.getResource("/");
+            if (rootURL.getProtocol().equals("jndi")) {
+                //this is tomcat case, we should use getRealPath
+                File warRootFile = new File(servletContext.getRealPath("/"));
+                contributionRoot = warRootFile.toURL().toString();
+            } else {
+                //this is jetty case
+                contributionRoot  = rootURL.toString();
+            }
+        } catch(MalformedURLException mf) {
+            //ignore, pass null
+        }
+                
+        
         if (scaDomain == null) {
-            scaDomain = SCADomain.newInstance();
+            scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
             servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
         }
         return scaDomain;



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org