[110954] Create web.xml for default context to avoid confusing log message
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
index a91b96e..fd8f91b 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Configuration.java
@@ -569,9 +569,21 @@
temp = confDir.append("temp").toFile();
if (!temp.exists())
temp.mkdirs();
- temp = confDir.append("webapps/ROOT/WEB-INF").toFile();
+ IPath tempPath = confDir.append("webapps/ROOT/WEB-INF");
+ temp = tempPath.toFile();
if (!temp.exists())
temp.mkdirs();
+ temp = tempPath.append("web.xml").toFile();
+ if (!temp.exists()) {
+ FileWriter fw;
+ try {
+ fw = new FileWriter(temp);
+ fw.write(DEFAULT_WEBXML_SERVLET23);
+ fw.close();
+ } catch (IOException e) {
+ Trace.trace(Trace.WARNING, "Unable to create web.xml for ROOT context.", e);
+ }
+ }
temp = confDir.append("work").toFile();
if (!temp.exists())
temp.mkdirs();
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
index 3c73e44..7c1c1d0 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Configuration.java
@@ -711,9 +711,21 @@
temp = confDir.append("temp").toFile();
if (!temp.exists())
temp.mkdirs();
- temp = confDir.append("webapps/ROOT/WEB-INF").toFile();
+ IPath tempPath = confDir.append("webapps/ROOT/WEB-INF");
+ temp = tempPath.toFile();
if (!temp.exists())
temp.mkdirs();
+ temp = tempPath.append("web.xml").toFile();
+ if (!temp.exists()) {
+ FileWriter fw;
+ try {
+ fw = new FileWriter(temp);
+ fw.write(DEFAULT_WEBXML_SERVLET23);
+ fw.close();
+ } catch (IOException e) {
+ Trace.trace(Trace.WARNING, "Unable to create web.xml for ROOT context.", e);
+ }
+ }
temp = confDir.append("work").toFile();
if (!temp.exists())
temp.mkdirs();
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
index f28d154..50e464e 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Configuration.java
@@ -788,9 +788,21 @@
temp = confDir.append("temp").toFile();
if (!temp.exists())
temp.mkdirs();
- temp = confDir.append("webapps/ROOT/WEB-INF").toFile();
+ IPath tempPath = confDir.append("webapps/ROOT/WEB-INF");
+ temp = tempPath.toFile();
if (!temp.exists())
temp.mkdirs();
+ temp = tempPath.append("web.xml").toFile();
+ if (!temp.exists()) {
+ FileWriter fw;
+ try {
+ fw = new FileWriter(temp);
+ fw.write(DEFAULT_WEBXML_SERVLET24);
+ fw.close();
+ } catch (IOException e) {
+ Trace.trace(Trace.WARNING, "Unable to create web.xml for ROOT context.", e);
+ }
+ }
temp = confDir.append("work").toFile();
if (!temp.exists())
temp.mkdirs();
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
index f3ca74a..8f616ca 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Configuration.java
@@ -688,9 +688,21 @@
temp = confDir.append("temp").toFile();
if (!temp.exists())
temp.mkdirs();
- temp = confDir.append("webapps/ROOT/WEB-INF").toFile();
+ IPath tempPath = confDir.append("webapps/ROOT/WEB-INF");
+ temp = tempPath.toFile();
if (!temp.exists())
temp.mkdirs();
+ temp = tempPath.append("web.xml").toFile();
+ if (!temp.exists()) {
+ FileWriter fw;
+ try {
+ fw = new FileWriter(temp);
+ fw.write(DEFAULT_WEBXML_SERVLET24);
+ fw.close();
+ } catch (IOException e) {
+ Trace.trace(Trace.WARNING, "Unable to create web.xml for ROOT context.", e);
+ }
+ }
temp = confDir.append("work").toFile();
if (!temp.exists())
temp.mkdirs();
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
index f5c7fa3..3fce997 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatConfiguration.java
@@ -42,6 +42,16 @@
public static final String ADD_WEB_MODULE_PROPERTY = "addWebModule";
public static final String REMOVE_WEB_MODULE_PROPERTY = "removeWebModule";
+ public static final String DEFAULT_WEBXML_SERVLET23 =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE web-app PUBLIC \"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN\" \"http://java.sun.com/dtd/web-app_2_3.dtd\">\n" +
+ "<web-app>\n</web-app>";
+
+ public static final String DEFAULT_WEBXML_SERVLET24 =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<web-app id=\"WebApp_ID\" version=\"2.4\" xmlns=\"http://java.sun.com/xml/ns/j2ee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\">\n" +
+ "</web-app>";
+
protected IFolder configPath;
// property change listeners