[342505] Add support for multilevel context-root when "Publish module contexts to separate XML files" is enabled.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatVersionHelper.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatVersionHelper.java
index e3c8774..3fda44e 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatVersionHelper.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatVersionHelper.java
@@ -989,7 +989,12 @@
 					if (name.length() == 0) {
 						name = "ROOT";
 					}
-					
+					// Update name if multi-level path.  For 5.5 and later the "#" has been
+					// "reserved" as a legal file name placeholder for "/".  For Tomcat 5.0,
+					// we just need a legal unique file name since "/" will fail.  Prior to
+					// 5.0, this feature is not supported.
+					name = name.replace('/', '#');
+
 					// TODO Determine circumstances, if any, where setting antiResourceLocking true can cause the original docBase content to be deleted.
 					if (Boolean.valueOf(context.getAttributeValue("antiResourceLocking")).booleanValue())
 						context.setAttributeValue("antiResourceLocking", "false");
@@ -1068,6 +1073,8 @@
 						path = fileName.substring(0, fileName.length() - ".xml".length());
 						if ("ROOT".equals(path))
 							path = "";
+						// Assuming this use for "#" since Tomcat has "reserved" this use of "#" since 5.5.
+						path = path.replace('#', '/');
 						context.setPath("/" + path);
 					}
 				}