You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/05/23 10:09:07 UTC

svn commit: r777830 - /tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java

Author: antelder
Date: Sat May 23 08:09:07 2009
New Revision: 777830

URL: http://svn.apache.org/viewvc?rev=777830&view=rev
Log:
Fix NPE when using jetty:run plugin with webapps, change contribution to be entire webapp instead of just web-inf/classes, change to use getrealpath instead of getContextName for the nodeURI to be compatable with Tomcat 5.x

Modified:
    tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java

Modified: tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java?rev=777830&r1=777829&r2=777830&view=diff
==============================================================================
--- tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java (original)
+++ tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/ServletHostHelper.java Sat May 23 08:09:07 2009
@@ -66,7 +66,7 @@
                 path = "/" + path;
             }
             URL url = servletContext.getResource(path);
-            if (url.getProtocol().equals("jndi")) {
+            if (url != null && url.getProtocol().equals("jndi")) {
                 //this is Tomcat case, we should use getRealPath
                 File warRootFile = new File(servletContext.getRealPath(path));
                 return warRootFile.toURI().toURL();
@@ -97,7 +97,7 @@
             }
             if (configuration.getContributions().isEmpty()) {
                 // TODO: Which path should be the default root
-                configuration.addContribution(getResource(servletContext, "/WEB-INF/classes"));
+                configuration.addContribution(getResource(servletContext, "/"));
             }
             URL composite = getResource(servletContext, "/WEB-INF/web.composite");
             if (composite != null) {
@@ -105,7 +105,7 @@
             }
             String nodeURI = servletContext.getInitParameter("node.uri");
             if (nodeURI == null) {
-                nodeURI = servletContext.getContextPath();
+                nodeURI = new File(servletContext.getRealPath("/")).getName();
             }
             configuration.setURI(nodeURI);
             String domainURI = servletContext.getInitParameter("domain.uri");