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 2007/05/14 09:54:30 UTC

svn commit: r537743 - in /incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp: TuscanyServlet.java WebAppServletHost.java

Author: antelder
Date: Mon May 14 00:54:26 2007
New Revision: 537743

URL: http://svn.apache.org/viewvc?view=rev&rev=537743
Log:
When servlet init is called on the Tuscany servelt have it call init on all the registered servlets

Modified:
    incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java
    incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java

Modified: incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java?view=diff&rev=537743&r1=537742&r2=537743
==============================================================================
--- incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java (original)
+++ incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java Mon May 14 00:54:26 2007
@@ -46,6 +46,7 @@
 
         // TODO: must be a better way to get this than using a static
         servletHost = WebAppServletHost.getInstance();
+        servletHost.init(config);
     }
 
     @Override

Modified: incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java?view=diff&rev=537743&r1=537742&r2=537743
==============================================================================
--- incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java (original)
+++ incubator/tuscany/java/sca/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java Mon May 14 00:54:26 2007
@@ -24,6 +24,8 @@
 import java.util.Map;
 
 import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
 
 import org.apache.tuscany.sca.http.ServletHost;
 import org.apache.tuscany.sca.http.ServletMappingException;
@@ -59,11 +61,28 @@
     }
 
     public Servlet getServlet(String path) {
-        return servlets.get(path);
+        Servlet servlet = servlets.get(path);
+        if (servlet != null) {
+            return servlet;
+        }
+        for (String servletPath : servlets.keySet()) {
+            if (servletPath.endsWith("*")) {
+                if (path.startsWith(servletPath.substring(0, servletPath.length()-1))) { 
+                    return servlets.get(servletPath);
+                }
+            }
+        }
+        return null;
     }
 
     public static WebAppServletHost getInstance() {
         return instance;
+    }
+    
+    public void init(ServletConfig config) throws ServletException {
+        for (Servlet servlet : servlets.values()) {
+            servlet.init(config);
+        }
     }
 
 }



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