[335646] Address coming changes in Tomcat 7.0.7 so "Serve modules without publishing" keeps working.
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/build.properties b/plugins/org.eclipse.jst.server.tomcat.core/build.properties
index 378c1d5..187fbc5 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/build.properties
+++ b/plugins/org.eclipse.jst.server.tomcat.core/build.properties
@@ -18,7 +18,8 @@
org.eclipse.jst.server.tomcat.runtime.50.loader.jar,\
org.eclipse.jst.server.tomcat.runtime.55.loader.jar,\
org.eclipse.jst.server.tomcat.runtime.60.loader.jar,\
- org.eclipse.jst.server.tomcat.runtime.70.loader.jar
+ org.eclipse.jst.server.tomcat.runtime.70.loader.jar,\
+ org.eclipse.jst.server.tomcat.runtime.706.loader.jar
bin.excludes = bin/**,\
@dot/**,\
temp.folder/**
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.70.loader.jar b/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.70.loader.jar
index eab0716..42d56c9 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.70.loader.jar
+++ b/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.70.loader.jar
Binary files differ
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.706.loader.jar b/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.706.loader.jar
new file mode 100644
index 0000000..eab0716
--- /dev/null
+++ b/plugins/org.eclipse.jst.server.tomcat.core/org.eclipse.jst.server.tomcat.runtime.706.loader.jar
Binary files differ
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java
index 319848f..89edad8 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/ITomcatVersionHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -132,7 +132,7 @@
* if serving directly is enabled
* @return status result of the operation
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server);
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion);
/**
* Gets the name of the "shared" loader to use with serving
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java
index b7e698f..bf8b227 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat32Handler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -150,7 +150,7 @@
/**
* @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion) {
if (server.isServeModulesWithoutPublish())
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorNoPublishNotSupported, null);
return Status.OK_STATUS;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java
index 60f3fb2..352376e 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat40Handler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -143,7 +143,7 @@
/**
* @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion) {
if (server.isServeModulesWithoutPublish())
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorNoPublishNotSupported, null);
return Status.OK_STATUS;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java
index 8648b1c..0a3e3f8 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -136,7 +136,7 @@
/**
* @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion) {
if (server.isServeModulesWithoutPublish())
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorNoPublishNotSupported, null);
return Status.OK_STATUS;
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java
index 192679e..8a39552 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java
@@ -136,13 +136,13 @@
/**
* @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion) {
IStatus status;
// If serving modules without publishing, loader jar is needed
if (server.isServeModulesWithoutPublish()) {
status = TomcatVersionHelper.copyLoaderJar(
getRuntimeBaseDirectory(server).append("server/lib"),
- server.getServer().getRuntime().getRuntimeType().getId());
+ server.getServer().getRuntime().getRuntimeType().getId(), tomcatVersion);
// If copy successful and running a separate server instance, modify catalina.properties
if (status.isOK() && server.isTestEnvironment()) {
status = TomcatVersionHelper.updatePropertiesToServeDirectly(baseDir, "server/lib", "server");
@@ -152,7 +152,7 @@
else {
TomcatVersionHelper.removeLoaderJar(
getRuntimeBaseDirectory(server).append("server/lib"),
- server.getServer().getRuntime().getRuntimeType().getId());
+ server.getServer().getRuntime().getRuntimeType().getId(), tomcatVersion);
// TODO Decide what to do with removal warning, maybe nothing
status = Status.OK_STATUS;
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Handler.java
index c141d5e..1b1e807 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Handler.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -130,14 +130,14 @@
/**
* @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion) {
IStatus status;
// If serving modules without publishing, loader jar is needed
// TODO Need to examine catalina.properties to ensure loader jar and catalina.properties are handled appropriately
if (server.isServeModulesWithoutPublish()) {
status = TomcatVersionHelper.copyLoaderJar(
getRuntimeBaseDirectory(server).append("lib"),
- server.getServer().getRuntime().getRuntimeType().getId());
+ server.getServer().getRuntime().getRuntimeType().getId(), tomcatVersion);
// If copy successful and running a separate server instance, modify catalina.properties
if (status.isOK() && server.isTestEnvironment()) {
status = TomcatVersionHelper.updatePropertiesToServeDirectly(baseDir, "lib", "common");
@@ -147,7 +147,7 @@
else {
TomcatVersionHelper.removeLoaderJar(
getRuntimeBaseDirectory(server).append("lib"),
- server.getServer().getRuntime().getRuntimeType().getId());
+ server.getServer().getRuntime().getRuntimeType().getId(), tomcatVersion);
// TODO Decide what to do with removal warning, maybe nothing
status = Status.OK_STATUS;
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat70Handler.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat70Handler.java
index 2a02f8c..d803bf4 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat70Handler.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat70Handler.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -143,14 +143,14 @@
/**
* @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
*/
- public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
+ public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server, String tomcatVersion) {
IStatus status;
// If serving modules without publishing, loader jar is needed
// TODO Need to examine catalina.properties to ensure loader jar and catalina.properties are handled appropriately
if (server.isServeModulesWithoutPublish()) {
status = TomcatVersionHelper.copyLoaderJar(
getRuntimeBaseDirectory(server).append("lib"),
- server.getServer().getRuntime().getRuntimeType().getId());
+ server.getServer().getRuntime().getRuntimeType().getId(), tomcatVersion);
// If copy successful and running a separate server instance, modify catalina.properties
if (status.isOK() && server.isTestEnvironment()) {
status = TomcatVersionHelper.updatePropertiesToServeDirectly(baseDir, "lib", "common");
@@ -160,7 +160,7 @@
else {
TomcatVersionHelper.removeLoaderJar(
getRuntimeBaseDirectory(server).append("lib"),
- server.getServer().getRuntime().getRuntimeType().getId());
+ server.getServer().getRuntime().getRuntimeType().getId(), tomcatVersion);
// TODO Decide what to do with removal warning, maybe nothing
status = Status.OK_STATUS;
}
diff --git a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
index 41f9e8d..e854c42 100644
--- a/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
+++ b/plugins/org.eclipse.jst.server.tomcat.core/tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServerBehaviour.java
@@ -446,13 +446,13 @@
IPath baseDir = getRuntimeBaseDirectory();
TomcatServer ts = getTomcatServer();
ITomcatVersionHandler tvh = getTomcatVersionHandler();
+ String serverTypeID = getServer().getServerType().getId();
+ String tomcatVersion = TomcatVersionHelper.getCatalinaVersion(getServer().getRuntime().getLocation(), serverTypeID);
// Include or remove loader jar depending on state of serving directly
- status = tvh.prepareForServingDirectly(baseDir, getTomcatServer());
+ status = tvh.prepareForServingDirectly(baseDir, getTomcatServer(), tomcatVersion);
if (status.isOK()) {
- String serverTypeID = getServer().getServerType().getId();
// If serving modules directly, update server.xml accordingly (includes project context.xmls)
if (ts.isServeModulesWithoutPublish()) {
- String tomcatVersion = TomcatVersionHelper.getCatalinaVersion(getServer().getRuntime().getLocation(), serverTypeID);
status = getTomcatConfiguration().updateContextsToServeDirectly(
baseDir, tomcatVersion, tvh.getSharedLoader(baseDir), monitor);
}
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 9b53b01..1fdee43 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
@@ -753,8 +753,8 @@
* @param serverId ID of the server receiving the jar
* @return result of copy operation
*/
- public static IStatus copyLoaderJar(IPath destDir, String serverId) {
- String loaderJar = "/" + serverId + ".loader.jar";
+ public static IStatus copyLoaderJar(IPath destDir, String serverId, String tomcatVersion) {
+ String loaderJar = getLoaderJarFile(serverId, tomcatVersion);
URL installURL = TomcatPlugin.getInstance().getBundle().getEntry(loaderJar);
if (installURL == null) {
Trace.trace(Trace.SEVERE, "Loader jar not found for server ID " + serverId);
@@ -784,9 +784,16 @@
* @param serverId ID of the server from which to delete the jar
* @return result of copy operation
*/
- public static IStatus removeLoaderJar(IPath destDir, String serverId) {
- String loaderJar = "/" + serverId + ".loader.jar";
+ public static IStatus removeLoaderJar(IPath destDir, String serverId, String tomcatVersion) {
+ String loaderJar = getLoaderJarFile(serverId, tomcatVersion);
File loaderFile = destDir.append(loaderJar).toFile();
+ // If Tomcat 7, see if jar to remove exists. If not, ensure default jar is not present
+ if ("org.eclipse.jst.server.tomcat.runtime.70".equals(serverId) && tomcatVersion != null) {
+ if (!loaderFile.exists()) {
+ loaderJar = getLoaderJarFile(serverId, "");
+ loaderFile = destDir.append(loaderJar).toFile();
+ }
+ }
// If loader jar exists but is not successfully deleted, return warning
if (loaderFile.exists() && !loaderFile.delete())
return new Status(IStatus.WARNING, TomcatPlugin.PLUGIN_ID, 0,
@@ -794,6 +801,62 @@
return Status.OK_STATUS;
}
+
+ public static String getLoaderJarFile(String serverId, String tomcatVersion) {
+ String loaderJar = "/" + serverId + ".loader.jar";
+ // If Tomcat 7.0, we need to determine the older jar should be used
+ if ("org.eclipse.jst.server.tomcat.runtime.70".equals(serverId) && tomcatVersion != null) {
+ int index = tomcatVersion.indexOf('.');
+ if (index >= 0 && tomcatVersion.length() > index + 1) {
+ String versionStr = tomcatVersion.substring(0, index);
+ try {
+ int version = Integer.parseInt(versionStr);
+ if (version == 7) {
+ int index2 = tomcatVersion.indexOf('.', index + 1);
+ if (index2 >= 0 && tomcatVersion.length() > index2 + 1) {
+ versionStr = tomcatVersion.substring(index + 1, index2);
+ try {
+ version = Integer.parseInt(versionStr);
+ if (version == 0) {
+ int index3 = tomcatVersion.indexOf('.', index2 + 1);
+ if (index3 >= 0 && tomcatVersion.length() > index3 + 1) {
+ versionStr = tomcatVersion.substring(index2 + 1, index3);
+ }
+ else {
+ versionStr = tomcatVersion.substring(index2 + 1);
+ for (int i = 0; i < versionStr.length(); i++) {
+ if (!Character.isDigit(versionStr.charAt(i))) {
+ versionStr = versionStr.substring(0, i);
+ break;
+ }
+ }
+ }
+ try {
+ version = Integer.parseInt(versionStr);
+ if (version <= 6) {
+ // Use the jar for Tomcat 7.0.6 or earlier.
+ loaderJar = "/" + serverId + "6.loader.jar";
+ }
+ }
+ catch (NumberFormatException e) {
+ // Ignore and copy default jar
+ }
+ }
+ }
+ catch (NumberFormatException e) {
+ // Ignore and copy default jar
+ }
+ }
+ }
+ }
+ catch (NumberFormatException e) {
+ // Ignore and copy default jar
+ }
+ }
+ }
+ return loaderJar;
+ }
+
/**
* Updates the catalina.properties file to include a extra entry in the
* specified loader property to pickup the loader jar.