Author: antelder
Date: Wed Nov 14 08:57:19 2007
New Revision: 594943

URL: http://svn.apache.org/viewvc?rev=594943&view=rev
Log:
Add setter to set the context path for the server (to support nodes and domains 
using paths)

Modified:
    
incubator/tuscany/java/sca/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java

Modified: 
incubator/tuscany/java/sca/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java?rev=594943&r1=594942&r2=594943&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
 Wed Nov 14 08:57:19 2007
@@ -93,6 +93,8 @@
 
     private WorkScheduler workScheduler;
 
+    private String contextPath = "/";
+
     /**
      * Constructs a new embedded Tomcat server.
      *
@@ -186,8 +188,8 @@
 
         // Register the servlet mapping
         String path = uri.getPath();
-        if (!path.startsWith("/")) {
-            path = '/' + path;
+        if (!path.startsWith(contextPath)) {
+            path = contextPath + path;
         }
         
         ServletWrapper wrapper;
@@ -262,8 +264,8 @@
         
         // Construct the URL
         String path = uri.getPath();
-        if (!path.startsWith("/")) {
-            path = '/' + path;
+        if (!path.startsWith(contextPath)) {
+            path = contextPath + path;
         }
         URL url;
         try {
@@ -356,7 +358,7 @@
     }
     
     public String getContextPath() {
-        return "/";
+        return contextPath;
     }
 
     /**
@@ -428,6 +430,10 @@
         CustomConnector() throws Exception {
             protocolHandler = new CustomHttpProtocolHandler();
         }
+    }
+
+    public void setContextPath(String path) {
+        this.contextPath = path;
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to