Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 308916
Collapse All | Expand All

(-)plugin.xml (+12 lines)
Lines 27-32 Link Here
27
         id="org.eclipse.jst.server.tomcat.60"
27
         id="org.eclipse.jst.server.tomcat.60"
28
         icon="icons/obj16/tomcat.gif"
28
         icon="icons/obj16/tomcat.gif"
29
         typeIds="org.eclipse.jst.server.tomcat.runtime.60"/>
29
         typeIds="org.eclipse.jst.server.tomcat.runtime.60"/>
30
      <image
31
         id="org.eclipse.jst.server.tomcat.70"
32
         icon="icons/obj16/tomcat.gif"
33
         typeIds="org.eclipse.jst.server.tomcat.runtime.70"/>
30
34
31
      <image
35
      <image
32
         id="org.eclipse.jst.server.tomcat.32"
36
         id="org.eclipse.jst.server.tomcat.32"
Lines 52-57 Link Here
52
         id="org.eclipse.jst.server.tomcat.60"
56
         id="org.eclipse.jst.server.tomcat.60"
53
         icon="icons/obj16/tomcat.gif"
57
         icon="icons/obj16/tomcat.gif"
54
         typeIds="org.eclipse.jst.server.tomcat.60"/>
58
         typeIds="org.eclipse.jst.server.tomcat.60"/>
59
      <image
60
         id="org.eclipse.jst.server.tomcat.70"
61
         icon="icons/obj16/tomcat.gif"
62
         typeIds="org.eclipse.jst.server.tomcat.70"/>
55
   </extension>
63
   </extension>
56
   
64
   
57
   <extension point="org.eclipse.core.expressions.propertyTesters">
65
   <extension point="org.eclipse.core.expressions.propertyTesters">
Lines 137-142 Link Here
137
         id="org.eclipse.jst.server.tomcat.runtime.60"
145
         id="org.eclipse.jst.server.tomcat.runtime.60"
138
         typeIds="org.eclipse.jst.server.tomcat.runtime.60"
146
         typeIds="org.eclipse.jst.server.tomcat.runtime.60"
139
         class="org.eclipse.jst.server.tomcat.ui.internal.TomcatRuntimeWizardFragment"/>
147
         class="org.eclipse.jst.server.tomcat.ui.internal.TomcatRuntimeWizardFragment"/>
148
      <fragment
149
         id="org.eclipse.jst.server.tomcat.runtime.70"
150
         typeIds="org.eclipse.jst.server.tomcat.runtime.70"
151
         class="org.eclipse.jst.server.tomcat.ui.internal.TomcatRuntimeWizardFragment"/>
140
   </extension>
152
   </extension>
141
153
142
  <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
154
  <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatServer.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 99-104 Link Here
99
				configuration = new Tomcat55Configuration(folder);
99
				configuration = new Tomcat55Configuration(folder);
100
			else if (id.indexOf("60") > 0)
100
			else if (id.indexOf("60") > 0)
101
				configuration = new Tomcat60Configuration(folder);
101
				configuration = new Tomcat60Configuration(folder);
102
			else if (id.indexOf("70") > 0)
103
				configuration = new Tomcat70Configuration(folder);
102
			try {
104
			try {
103
				configuration.load(folder, null);
105
				configuration.load(folder, null);
104
			} catch (CoreException ce) {
106
			} catch (CoreException ce) {
Lines 131-136 Link Here
131
			configuration = new Tomcat55Configuration(folder);
133
			configuration = new Tomcat55Configuration(folder);
132
		else if (id.indexOf("60") > 0)
134
		else if (id.indexOf("60") > 0)
133
			configuration = new Tomcat60Configuration(folder);
135
			configuration = new Tomcat60Configuration(folder);
136
		else if (id.indexOf("70") > 0)
137
			configuration = new Tomcat70Configuration(folder);
134
		try {
138
		try {
135
			configuration.importFromPath(path, isTestEnvironment(), monitor);
139
			configuration.importFromPath(path, isTestEnvironment(), monitor);
136
		} catch (CoreException ce) {
140
		} catch (CoreException ce) {
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat41Handler.java (-1 / +6 lines)
Lines 26-32 Link Here
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
27
	 */
27
	 */
28
	public IStatus verifyInstallPath(IPath installPath) {
28
	public IStatus verifyInstallPath(IPath installPath) {
29
		return TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_41);
29
		IStatus result = TomcatVersionHelper.checkCatalinaVersion(installPath, TomcatPlugin.TOMCAT_41);
30
		// If check was canceled, use folder check
31
		if (result.getSeverity() == IStatus.CANCEL) {
32
			result = TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_41);
33
		}
34
		return result;
30
	}
35
	}
31
	
36
	
32
	/**
37
	/**
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatRuntime.java (-2 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 169-175 Link Here
169
				}
169
				}
170
			}
170
			}
171
		}
171
		}
172
		
172
		// Else for Tomcat 7.0, ensure we have J2SE 5.0
173
		else if (id != null && id.indexOf("70") > 0) {
174
			IVMInstall vmInstall = getVMInstall();
175
			if (vmInstall instanceof IVMInstall2) {
176
				String javaVersion = ((IVMInstall2)vmInstall).getJavaVersion();
177
				if (javaVersion != null && javaVersion.compareTo("1.5") < 0) {
178
					return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorJRETomcat70, null);
179
				}
180
			}
181
		}
182
173
		return Status.OK_STATUS;
183
		return Status.OK_STATUS;
174
	}
184
	}
175
185
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat60Handler.java (-1 / +6 lines)
Lines 26-32 Link Here
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
27
	 */
27
	 */
28
	public IStatus verifyInstallPath(IPath installPath) {
28
	public IStatus verifyInstallPath(IPath installPath) {
29
		return TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_60);
29
		IStatus result = TomcatVersionHelper.checkCatalinaVersion(installPath, TomcatPlugin.TOMCAT_60);
30
		// If check was canceled, use folder check
31
		if (result.getSeverity() == IStatus.CANCEL) {
32
			result = TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_60);
33
		}
34
		return result;
30
	}
35
	}
31
	
36
	
32
	/**
37
	/**
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatVersionHelper.java (+135 lines)
Lines 19-31 Link Here
19
import java.io.IOException;
19
import java.io.IOException;
20
import java.io.InputStream;
20
import java.io.InputStream;
21
import java.io.InputStreamReader;
21
import java.io.InputStreamReader;
22
import java.net.MalformedURLException;
22
import java.net.URL;
23
import java.net.URL;
24
import java.net.URLClassLoader;
23
import java.util.ArrayList;
25
import java.util.ArrayList;
24
import java.util.Collection;
26
import java.util.Collection;
25
import java.util.HashMap;
27
import java.util.HashMap;
26
import java.util.Iterator;
28
import java.util.Iterator;
27
import java.util.List;
29
import java.util.List;
28
import java.util.Map;
30
import java.util.Map;
31
import java.util.Properties;
32
import java.util.concurrent.ConcurrentHashMap;
29
33
30
import javax.xml.parsers.DocumentBuilder;
34
import javax.xml.parsers.DocumentBuilder;
31
35
Lines 92-97 Link Here
92
		"</web-app>";
96
		"</web-app>";
93
97
94
	/**
98
	/**
99
	 * Map of server type ID to expected version string fragment for version checking.
100
	 */
101
	private static final Map versionStringMap = new HashMap();
102
	
103
	static {
104
		versionStringMap.put(TomcatPlugin.TOMCAT_41, "4.1.");
105
		versionStringMap.put(TomcatPlugin.TOMCAT_50, "5.0.");
106
		versionStringMap.put(TomcatPlugin.TOMCAT_55, "5.5.");
107
		versionStringMap.put(TomcatPlugin.TOMCAT_60, "6.0.");
108
		versionStringMap.put(TomcatPlugin.TOMCAT_70, "7.0.");
109
	}
110
111
	/**
95
	 * Reads the from the specified InputStream and returns
112
	 * Reads the from the specified InputStream and returns
96
	 * the result as a String. Each line is terminated by
113
	 * the result as a String. Each line is terminated by
97
	 * &quot;\n&quot;.  Returns whatever is read regardless
114
	 * &quot;\n&quot;.  Returns whatever is read regardless
Lines 1001-1004 Link Here
1001
		}
1018
		}
1002
		return context;
1019
		return context;
1003
	}
1020
	}
1021
1022
	private static Map catalinaJarVersion = new ConcurrentHashMap();
1023
	private static Map catalinaJarLastModified = new HashMap();
1024
	private static volatile long lastCheck = 0;
1025
1026
	/**
1027
	 * Checks if the version of Tomcat installed at the specified location matches
1028
	 * the specified server type.  The return status indicates if the version matches
1029
	 * or not, or can't be determined.
1030
	 * 
1031
	 * Because this can get called repeatedly for certain operations, some caching
1032
	 * is provided.  The first check for an installPath in the current Eclipse
1033
	 * session will query the catalina.jar for its version.  Any additional
1034
	 * checks will compare the catalina.jar's time stamp and will use the previously
1035
	 * cached version if it didn't change.  Additional checks that occur within
1036
	 * 2 seconds of the last check, regardless of Tomcat version, don't bother with
1037
	 * checking the jar time stamp and just use the cached values.
1038
	 * 
1039
	 * @param installPath Path to Tomcat installation
1040
	 * @param serverType The server type ID for the desired version of Tomcat
1041
	 * @return Returns Status.OK_Status if check succeeds, or an error status
1042
	 * if the check fails.  If the check can't determine if the version matches,
1043
	 * Status.CANCEL_STATUS is returned.
1044
	 */
1045
	public static IStatus checkCatalinaVersion(IPath installPath, String serverType) {
1046
		String versionSubString = null;
1047
		IPath catalinaJarPath = null;
1048
		File jarFile = null;
1049
		
1050
		if (TomcatPlugin.TOMCAT_60.equals(serverType) || TomcatPlugin.TOMCAT_70.equals(serverType)) {
1051
			catalinaJarPath = installPath.append("lib").append("catalina.jar");
1052
			jarFile = catalinaJarPath.toFile();
1053
			// If jar is not at expected location, try alternate location
1054
			if (!jarFile.exists()) {
1055
				catalinaJarPath = installPath.append("server/lib").append("catalina.jar");
1056
				jarFile = catalinaJarPath.toFile();
1057
				// If not here either, discard path
1058
				if (!jarFile.exists()) {
1059
					catalinaJarPath = null;
1060
				}
1061
			}
1062
		}
1063
		else if (TomcatPlugin.TOMCAT_50.equals(serverType) || TomcatPlugin.TOMCAT_55.equals(serverType)
1064
				 || TomcatPlugin.TOMCAT_41.equals(serverType)) {
1065
			catalinaJarPath = installPath.append("server/lib").append("catalina.jar");
1066
			jarFile = catalinaJarPath.toFile();
1067
			// If jar is not at expected location, try alternate location
1068
			if (!jarFile.exists()) {
1069
				catalinaJarPath = installPath.append("lib").append("catalina.jar");
1070
				jarFile = catalinaJarPath.toFile();
1071
				// If not here either, discard path
1072
				if (!jarFile.exists()) {
1073
					catalinaJarPath = null;
1074
				}
1075
			}
1076
		}
1077
		if (catalinaJarPath != null) {
1078
			versionSubString = (String)catalinaJarVersion.get(catalinaJarPath);
1079
			long checkTime = System.currentTimeMillis();
1080
			// Use some logic to try to determine if a cached value is stale
1081
			// If last check was more than a couple of seconds ago, check the jar time stamp 
1082
			if (versionSubString != null && (checkTime - lastCheck > 2000)) {
1083
				long curLastModified = jarFile.lastModified();
1084
				Long oldLastModified = (Long)catalinaJarLastModified.get(catalinaJarPath);
1085
				// If jar time stamps differ, discard the cached version string
1086
				if (oldLastModified == null || curLastModified != oldLastModified.longValue()) {
1087
					versionSubString = null;
1088
				}
1089
			}
1090
			lastCheck = checkTime;
1091
			// If a version string needs to be acquired
1092
			if (versionSubString == null) {
1093
				try {
1094
					// Read version string from catalina.jar
1095
					URL catalinaJarURL = jarFile.toURI().toURL();
1096
					URLClassLoader cl = new URLClassLoader(new URL [] { catalinaJarURL }, null);
1097
					InputStream is = cl.getResourceAsStream("org/apache/catalina/util/ServerInfo.properties");
1098
					if (is != null) {
1099
						Properties props = new Properties();
1100
						props.load(is);
1101
						String serverVersion = props.getProperty("server.info");
1102
						if (serverVersion != null) {
1103
							int index = serverVersion.indexOf("/");
1104
							if (index > 0) {
1105
								versionSubString = serverVersion.substring(index + 1);
1106
								catalinaJarVersion.put(catalinaJarPath, versionSubString);
1107
								catalinaJarLastModified.put(catalinaJarPath, new Long(jarFile.lastModified()));
1108
							}
1109
							else {
1110
								return Status.CANCEL_STATUS;
1111
							}
1112
						}
1113
					}
1114
					else {
1115
						return Status.CANCEL_STATUS;
1116
					}
1117
				} catch (MalformedURLException e) {
1118
					return Status.CANCEL_STATUS;
1119
				} catch (IOException e) {
1120
					return Status.CANCEL_STATUS;
1121
				}
1122
			}
1123
			if (versionSubString != null) {
1124
				String versionTest = (String)versionStringMap.get(serverType);
1125
				if (versionTest != null && !versionSubString.startsWith(versionTest)) {
1126
					return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID,
1127
							NLS.bind(Messages.errorInstallDirWrongVersion2,
1128
									versionSubString, versionTest.substring(0, versionTest.length() -1)));
1129
				}
1130
			}
1131
		}
1132
		// Else server type is not supported or jar doesn't exist
1133
		else {
1134
			return Status.CANCEL_STATUS;
1135
		}
1136
		
1137
		return Status.OK_STATUS;
1138
	}
1004
}
1139
}
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/TomcatPlugin.java (-1 / +22 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2007 IBM Corporation and others.
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 37-42 Link Here
37
	public static final String TOMCAT_50 = "org.eclipse.jst.server.tomcat.50";
37
	public static final String TOMCAT_50 = "org.eclipse.jst.server.tomcat.50";
38
	public static final String TOMCAT_55 = "org.eclipse.jst.server.tomcat.55";
38
	public static final String TOMCAT_55 = "org.eclipse.jst.server.tomcat.55";
39
	public static final String TOMCAT_60 = "org.eclipse.jst.server.tomcat.60";
39
	public static final String TOMCAT_60 = "org.eclipse.jst.server.tomcat.60";
40
	public static final String TOMCAT_70 = "org.eclipse.jst.server.tomcat.70";
40
41
41
	protected static final String VERIFY_INSTALL_FILE = "verifyInstall.properties";
42
	protected static final String VERIFY_INSTALL_FILE = "verifyInstall.properties";
42
	protected static VerifyResourceSpec[] verify32;
43
	protected static VerifyResourceSpec[] verify32;
Lines 45-50 Link Here
45
	protected static VerifyResourceSpec[] verify50;
46
	protected static VerifyResourceSpec[] verify50;
46
	protected static VerifyResourceSpec[] verify55;
47
	protected static VerifyResourceSpec[] verify55;
47
	protected static VerifyResourceSpec[] verify60;
48
	protected static VerifyResourceSpec[] verify60;
49
	protected static VerifyResourceSpec[] verify70;
48
	
50
	
49
	protected static final IStatus emptyInstallDirStatus = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorInstallDirEmpty, null);
51
	protected static final IStatus emptyInstallDirStatus = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorInstallDirEmpty, null);
50
	protected static final IStatus wrongDirVersionStatus = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorInstallDirWrongVersion, null);
52
	protected static final IStatus wrongDirVersionStatus = new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorInstallDirWrongVersion, null);
Lines 130-135 Link Here
130
			return new Tomcat55Handler();
132
			return new Tomcat55Handler();
131
		else if (TOMCAT_60.equals(id))
133
		else if (TOMCAT_60.equals(id))
132
			return new Tomcat60Handler();
134
			return new Tomcat60Handler();
135
		else if (TOMCAT_70.equals(id))
136
			return new Tomcat70Handler();
133
		else
137
		else
134
			return null;
138
			return null;
135
	}
139
	}
Lines 148-153 Link Here
148
		verify50 = new VerifyResourceSpec[0];
152
		verify50 = new VerifyResourceSpec[0];
149
		verify55 = new VerifyResourceSpec[0];
153
		verify55 = new VerifyResourceSpec[0];
150
		verify60 = new VerifyResourceSpec[0];
154
		verify60 = new VerifyResourceSpec[0];
155
		verify70 = new VerifyResourceSpec[0];
151
		
156
		
152
		try {
157
		try {
153
			URL url = getInstance().getBundle().getEntry(VERIFY_INSTALL_FILE);
158
			URL url = getInstance().getBundle().getEntry(VERIFY_INSTALL_FILE);
Lines 249-254 Link Here
249
			Trace.trace(Trace.FINEST, "Verify60: " + list.toString());
254
			Trace.trace(Trace.FINEST, "Verify60: " + list.toString());
250
			verify60 = new VerifyResourceSpec[list.size()];
255
			verify60 = new VerifyResourceSpec[list.size()];
251
			list.toArray(verify60);
256
			list.toArray(verify60);
257
258
			// v7.0
259
			// Check backdoor system property, use internal spec if not found
260
			verify = System.getProperty(PLUGIN_ID + ".verify70install");
261
			if (verify == null) {
262
				verify = p.getProperty("verify70install");
263
			}
264
			verify.replace('/', File.separatorChar);
265
266
			st = new StringTokenizer(verify, ",");
267
			list = new ArrayList();
268
			while (st.hasMoreTokens())
269
				list.add(new VerifyResourceSpec(st.nextToken()));
270
			Trace.trace(Trace.FINEST, "Verify70: " + list.toString());
271
			verify70 = new VerifyResourceSpec[list.size()];
272
			list.toArray(verify70);
252
		} catch (Exception e) {
273
		} catch (Exception e) {
253
			Trace.trace(Trace.SEVERE, "Could not load installation verification properties", e);
274
			Trace.trace(Trace.SEVERE, "Could not load installation verification properties", e);
254
		}
275
		}
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat55Handler.java (-1 / +6 lines)
Lines 22-28 Link Here
22
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
22
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
23
	 */
23
	 */
24
	public IStatus verifyInstallPath(IPath installPath) {
24
	public IStatus verifyInstallPath(IPath installPath) {
25
		return TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_55);
25
		IStatus result = TomcatVersionHelper.checkCatalinaVersion(installPath, TomcatPlugin.TOMCAT_55);
26
		// If check was canceled, use folder check
27
		if (result.getSeverity() == IStatus.CANCEL) {
28
			result = TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_55);
29
		}
30
		return result;
26
	}
31
	}
27
	
32
	
28
	/**
33
	/**
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Messages.properties (+3 lines)
Lines 60-65 Link Here
60
errorUnknownVersion=Unknown version of Tomcat was specified.
60
errorUnknownVersion=Unknown version of Tomcat was specified.
61
errorInstallDirEmpty=The Tomcat installation directory may not be empty.
61
errorInstallDirEmpty=The Tomcat installation directory may not be empty.
62
errorInstallDirWrongVersion=The name of the Tomcat installation directory indicates it is for different version of Tomcat.
62
errorInstallDirWrongVersion=The name of the Tomcat installation directory indicates it is for different version of Tomcat.
63
errorInstallDirWrongVersion2=The Apache Tomcat installation at this directory is version {0}.  Please select a directory containing a Tomcat {1} installation.
63
errorInstallDirDoesNotExist=The specified Tomcat installation directory does not exist.
64
errorInstallDirDoesNotExist=The specified Tomcat installation directory does not exist.
64
errorInstallDirMissingFile=The Tomcat installation directory is not valid. It is missing expected file or folder {0}.
65
errorInstallDirMissingFile=The Tomcat installation directory is not valid. It is missing expected file or folder {0}.
65
errorInstallDirMissingFile2=The Tomcat installation directory is not valid. It is missing expected file or folder {0} (alternate name {1}).
66
errorInstallDirMissingFile2=The Tomcat installation directory is not valid. It is missing expected file or folder {0} (alternate name {1}).
Lines 67-72 Link Here
67
errorInstallDirTrailingSlash=The Tomcat installation directory should not have a trailing slash.
68
errorInstallDirTrailingSlash=The Tomcat installation directory should not have a trailing slash.
68
errorJRE=The JRE could not be found. Edit the server and change the JRE location.
69
errorJRE=The JRE could not be found. Edit the server and change the JRE location.
69
errorJRETomcat60=Tomcat version 6.0 requires J2SE 5.0 or later.  Change the JRE to one that meets this requirement.
70
errorJRETomcat60=Tomcat version 6.0 requires J2SE 5.0 or later.  Change the JRE to one that meets this requirement.
71
errorJRETomcat70=Tomcat version 7.0 requires J2SE 5.0 or later.  Change the JRE to one that meets this requirement.
70
errorPortInvalid=The server cannot be started because one or more of the ports are invalid. Open the server editor and correct the invalid ports.
72
errorPortInvalid=The server cannot be started because one or more of the ports are invalid. Open the server editor and correct the invalid ports.
71
errorPortInUse=Port {0} required by {1} is already in use. The server may already be running in another process, or a system process may be using the port. \
73
errorPortInUse=Port {0} required by {1} is already in use. The server may already be running in another process, or a system process may be using the port. \
72
  To start this server you will need to stop the other process or change the port number(s).
74
  To start this server you will need to stop the other process or change the port number(s).
Lines 89-94 Link Here
89
errorSpec50=Tomcat version 5.0 only supports J2EE 1.2, 1.3, and 1.4 Web modules
91
errorSpec50=Tomcat version 5.0 only supports J2EE 1.2, 1.3, and 1.4 Web modules
90
errorSpec55=Tomcat version 5.5 only supports J2EE 1.2, 1.3, and 1.4 Web modules
92
errorSpec55=Tomcat version 5.5 only supports J2EE 1.2, 1.3, and 1.4 Web modules
91
errorSpec60=Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
93
errorSpec60=Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
94
errorSpec70=Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules
92
errorDuplicateContextRoot=Two or more Web modules defined in the configuration have the same context root ({0}). \
95
errorDuplicateContextRoot=Two or more Web modules defined in the configuration have the same context root ({0}). \
93
  To start this server you will need to remove the duplicate(s).
96
  To start this server you will need to remove the duplicate(s).
94
errorCouldNotLoadContextXml=Could not load the context configuration for the {0} context due to a syntax error or other exception.
97
errorCouldNotLoadContextXml=Could not load the context configuration for the {0} context due to a syntax error or other exception.
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Messages.java (+3 lines)
Lines 22-27 Link Here
22
	public static String errorUnknownVersion;
22
	public static String errorUnknownVersion;
23
	public static String errorInstallDirEmpty;
23
	public static String errorInstallDirEmpty;
24
	public static String errorInstallDirWrongVersion;
24
	public static String errorInstallDirWrongVersion;
25
	public static String errorInstallDirWrongVersion2;
25
	public static String errorInstallDirDoesNotExist;
26
	public static String errorInstallDirDoesNotExist;
26
	public static String errorInstallDirMissingFile;
27
	public static String errorInstallDirMissingFile;
27
	public static String errorInstallDirMissingFile2;
28
	public static String errorInstallDirMissingFile2;
Lines 29-34 Link Here
29
	public static String errorInstallDirTrailingSlash;
30
	public static String errorInstallDirTrailingSlash;
30
	public static String errorJRE;
31
	public static String errorJRE;
31
	public static String errorJRETomcat60;
32
	public static String errorJRETomcat60;
33
	public static String errorJRETomcat70;
32
	public static String warningJRE;
34
	public static String warningJRE;
33
	public static String warningCantReadConfig;
35
	public static String warningCantReadConfig;
34
	public static String target32runtime;
36
	public static String target32runtime;
Lines 50-55 Link Here
50
	public static String errorSpec50;
52
	public static String errorSpec50;
51
	public static String errorSpec55;
53
	public static String errorSpec55;
52
	public static String errorSpec60;
54
	public static String errorSpec60;
55
	public static String errorSpec70;
53
	public static String portServer;
56
	public static String portServer;
54
	public static String runtimeDirPrepared;
57
	public static String runtimeDirPrepared;
55
	public static String publishConfigurationTask;
58
	public static String publishConfigurationTask;
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat50Handler.java (-1 / +6 lines)
Lines 26-32 Link Here
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
27
	 */
27
	 */
28
	public IStatus verifyInstallPath(IPath installPath) {
28
	public IStatus verifyInstallPath(IPath installPath) {
29
		return TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_50);
29
		IStatus result = TomcatVersionHelper.checkCatalinaVersion(installPath, TomcatPlugin.TOMCAT_50);
30
		// If check was canceled, use folder check
31
		if (result.getSeverity() == IStatus.CANCEL) {
32
			result = TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_50);
33
		}
34
		return result;
30
	}
35
	}
31
	
36
	
32
	/**
37
	/**
(-)plugin.properties (-1 / +6 lines)
Lines 24-30 Link Here
24
runtimeTypeTomcat55Label=Apache Tomcat v5.5
24
runtimeTypeTomcat55Label=Apache Tomcat v5.5
25
runtimeTypeTomcat55Description=Apache Tomcat v5.5 supports J2EE 1.2, 1.3, and 1.4 Web modules.
25
runtimeTypeTomcat55Description=Apache Tomcat v5.5 supports J2EE 1.2, 1.3, and 1.4 Web modules.
26
runtimeTypeTomcat60Label=Apache Tomcat v6.0
26
runtimeTypeTomcat60Label=Apache Tomcat v6.0
27
runtimeTypeTomcat60Description=Apache Tomcat v6.0 supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules.
27
runtimeTypeTomcat60Description=Apache Tomcat v6.0 supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules.
28
runtimeTypeTomcat70Label=Apache Tomcat v7.0
29
runtimeTypeTomcat70Description=Apache Tomcat v7.0 supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules.
28
30
29
# --------------- Servers ---------------
31
# --------------- Servers ---------------
30
tomcat32ServerType=Tomcat v3.2 Server
32
tomcat32ServerType=Tomcat v3.2 Server
Lines 45-50 Link Here
45
tomcat60ServerType=Tomcat v6.0 Server
47
tomcat60ServerType=Tomcat v6.0 Server
46
tomcat60ServerDescription=Publishes and runs J2EE and Java EE Web projects and server configurations to a local Tomcat server.
48
tomcat60ServerDescription=Publishes and runs J2EE and Java EE Web projects and server configurations to a local Tomcat server.
47
49
50
tomcat70ServerType=Tomcat v7.0 Server
51
tomcat70ServerDescription=Publishes and runs J2EE and Java EE Web projects and server configurations to a local Tomcat server.
52
48
tomcatLaunchConfigurationType=Apache Tomcat
53
tomcatLaunchConfigurationType=Apache Tomcat
49
54
50
# --------------- General ---------------
55
# --------------- General ---------------
(-)verifyInstall.properties (-1 / +2 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2003, 2007 IBM Corporation and others.
2
# Copyright (c) 2003, 2010 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 17-19 Link Here
17
verify50install=common/lib/servlet-api.jar|[servletapi5].jar,common/lib/naming-common.jar,bin/bootstrap.jar,conf,webapps
17
verify50install=common/lib/servlet-api.jar|[servletapi5].jar,common/lib/naming-common.jar,bin/bootstrap.jar,conf,webapps
18
verify55install=common/i18n,bin/bootstrap.jar,conf,webapps
18
verify55install=common/i18n,bin/bootstrap.jar,conf,webapps
19
verify60install=lib/jasper-el.jar,lib/servlet-api.jar|[servletapi6].jar,bin/bootstrap.jar,conf,webapps
19
verify60install=lib/jasper-el.jar,lib/servlet-api.jar|[servletapi6].jar,bin/bootstrap.jar,conf,webapps
20
verify70install=lib/jasper-el.jar,lib/servlet-api.jar|[servletapi6].jar,bin/bootstrap.jar,conf,webapps
(-)plugin.xml (+50 lines)
Lines 92-97 Link Here
92
         types="jst.utility"
92
         types="jst.utility"
93
         versions="1.0"/>
93
         versions="1.0"/>
94
    </runtimeType>
94
    </runtimeType>
95
96
    <runtimeType
97
       id="org.eclipse.jst.server.tomcat.runtime.70"
98
       name="%runtimeTypeTomcat70Label"
99
       description="%runtimeTypeTomcat70Description"
100
       vendor="%apache"
101
       version="7.0"
102
       class="org.eclipse.jst.server.tomcat.core.internal.TomcatRuntime">
103
       <moduleType
104
         types="jst.web"
105
         versions="2.2, 2.3, 2.4, 2.5, 3.0"/>
106
       <moduleType
107
         types="jst.utility"
108
         versions="1.0"/>
109
    </runtimeType>
95
  </extension>
110
  </extension>
96
111
97
  <extension point="org.eclipse.wst.server.core.runtimeLocators">
112
  <extension point="org.eclipse.wst.server.core.runtimeLocators">
Lines 199-204 Link Here
199
       class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
214
       class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
200
       behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
215
       behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
201
     </serverType>
216
     </serverType>
217
     <serverType
218
       id="org.eclipse.jst.server.tomcat.70"
219
       name="%tomcat70ServerType"
220
       description="%tomcat70ServerDescription"
221
       supportsRemoteHosts="false"
222
       runtime="true"
223
       startTimeout="45000"
224
       stopTimeout="15000"
225
       initialState="stopped"
226
       hasConfiguration="true"
227
       launchConfigId="org.eclipse.jst.server.tomcat.core.launchConfigurationType"
228
       runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.70"
229
       class="org.eclipse.jst.server.tomcat.core.internal.TomcatServer"
230
       behaviourClass="org.eclipse.jst.server.tomcat.core.internal.TomcatServerBehaviour">
231
     </serverType>
202
  </extension>
232
  </extension>
203
233
204
  <extension point="org.eclipse.wst.server.core.serverLocators">
234
  <extension point="org.eclipse.wst.server.core.serverLocators">
Lines 266-271 Link Here
266
       type="org.eclipse.jst.server.tomcat"
296
       type="org.eclipse.jst.server.tomcat"
267
       version="6.0"/>
297
       version="6.0"/>
268
298
299
    <runtime-component-version
300
       type="org.eclipse.jst.server.tomcat"
301
       version="7.0"/>
302
269
    <adapter>
303
    <adapter>
270
      <runtime-component
304
      <runtime-component
271
         id="org.eclipse.jst.server.tomcat"/>
305
         id="org.eclipse.jst.server.tomcat"/>
Lines 346-351 Link Here
346
         id="jst.utility"
380
         id="jst.utility"
347
         version="1.0"/>
381
         version="1.0"/>
348
    </supported>
382
    </supported>
383
384
    <supported>
385
      <runtime-component
386
         id="org.eclipse.jst.server.tomcat"
387
         version="7.0"/>
388
      <facet
389
         id="jst.web"
390
         version="2.2,2.3,2.4,2.5,3.0"/>
391
      <facet
392
         id="jst.utility"
393
         version="1.0"/>
394
    </supported>
349
  </extension>
395
  </extension>
350
  
396
  
351
  <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
397
  <extension point="org.eclipse.wst.common.project.facet.core.defaultFacets">
Lines 380-385 Link Here
380
      runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.60"
426
      runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.60"
381
      runtime-component="org.eclipse.jst.server.tomcat"
427
      runtime-component="org.eclipse.jst.server.tomcat"
382
      version="6.0"/>
428
      version="6.0"/>
429
    <runtimeFacetMapping
430
      runtimeTypeId="org.eclipse.jst.server.tomcat.runtime.70"
431
      runtime-component="org.eclipse.jst.server.tomcat"
432
      version="7.0"/>
383
  </extension>
433
  </extension>
384
434
385
  <extension point="org.eclipse.wst.server.core.installableRuntimes">
435
  <extension point="org.eclipse.wst.server.core.installableRuntimes">
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat70Configuration.java (+710 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *    IBM Corporation - Initial API and implementation
10
 **********************************************************************/
11
package org.eclipse.jst.server.tomcat.core.internal;
12
13
import java.io.BufferedWriter;
14
import java.io.ByteArrayInputStream;
15
import java.io.File;
16
import java.io.FileInputStream;
17
import java.io.FileWriter;
18
import java.io.InputStream;
19
import java.util.ArrayList;
20
import java.util.HashMap;
21
import java.util.Iterator;
22
import java.util.List;
23
import java.util.Map;
24
25
import org.eclipse.core.resources.IFile;
26
import org.eclipse.core.resources.IFolder;
27
import org.eclipse.core.runtime.CoreException;
28
import org.eclipse.core.runtime.IPath;
29
import org.eclipse.core.runtime.IProgressMonitor;
30
import org.eclipse.core.runtime.IStatus;
31
import org.eclipse.core.runtime.Status;
32
import org.eclipse.jst.server.tomcat.core.internal.xml.Factory;
33
import org.eclipse.jst.server.tomcat.core.internal.xml.XMLUtil;
34
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector;
35
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context;
36
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener;
37
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server;
38
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance;
39
import org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service;
40
import org.eclipse.osgi.util.NLS;
41
import org.eclipse.wst.server.core.ServerPort;
42
import org.w3c.dom.Document;
43
import org.xml.sax.InputSource;
44
/**
45
 * Tomcat v7.0 server configuration.
46
 */
47
public class Tomcat70Configuration extends TomcatConfiguration {
48
	protected static final String DEFAULT_SERVICE = "Catalina";
49
	protected static final String EOL = System.getProperty("line.separator");
50
	protected Server server;
51
	protected ServerInstance serverInstance;
52
	protected Factory serverFactory;
53
	protected boolean isServerDirty;
54
55
	protected WebAppDocument webAppDocument;
56
57
	protected Document contextDocument;
58
59
	protected Document tomcatUsersDocument;
60
61
	protected String policyFile;
62
63
	protected String propertiesFile;
64
	
65
	protected static final Map protocolHandlerMap = new HashMap();
66
	static {
67
		protocolHandlerMap.put("org.apache.coyote.http11.Http11Protocol", "HTTP/1.1");
68
		protocolHandlerMap.put("org.apache.coyote.http11.Http11NioProtocol", "HTTP/1.1");
69
		protocolHandlerMap.put("org.apache.coyote.http11.Http11AprProtocol", "HTTP/1.1");
70
		protocolHandlerMap.put("org.apache.coyote.ajp.AjpAprProtocol", "AJP/1.3");
71
		protocolHandlerMap.put("org.apache.jk.server.JkCoyoteHandler", "AJP/1.3");
72
	}
73
	
74
	/**
75
	 * Tomcat60Configuration constructor.
76
	 * 
77
	 * @param path a path
78
	 */
79
	public Tomcat70Configuration(IFolder path) {
80
		super(path);
81
	}
82
83
	/**
84
	 * Return the port number.
85
	 * @return int
86
	 */
87
	public ServerPort getMainPort() {
88
		Iterator iterator = getServerPorts().iterator();
89
		while (iterator.hasNext()) {
90
			ServerPort port = (ServerPort) iterator.next();
91
			// Return only an HTTP port from the selected Service
92
			if (port.getProtocol().toLowerCase().equals("http") && port.getId().indexOf('/') < 0)
93
				return port;
94
		}
95
		return null;
96
	}
97
	
98
	/**
99
	 * Returns the mime mappings.
100
	 * @return java.util.List
101
	 */
102
	public List getMimeMappings() {
103
		return webAppDocument.getMimeMappings();
104
	}
105
106
	/**
107
	 * Returns a list of ServerPorts that this configuration uses.
108
	 *
109
	 * @return java.util.List
110
	 */
111
	public List getServerPorts() {
112
		List ports = new ArrayList();
113
	
114
		// first add server port
115
		try {
116
			int port = Integer.parseInt(server.getPort());
117
			ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
118
		} catch (Exception e) {
119
			// ignore
120
		}
121
	
122
		// add connectors
123
		try {
124
			String instanceServiceName = serverInstance.getService().getName();
125
			int size = server.getServiceCount();
126
			for (int i = 0; i < size; i++) {
127
				Service service = server.getService(i);
128
				int size2 = service.getConnectorCount();
129
				for (int j = 0; j < size2; j++) {
130
					Connector connector = service.getConnector(j);
131
					String name = "HTTP/1.1";
132
					String protocol2 = "HTTP";
133
					boolean advanced = true;
134
					String[] contentTypes = null;
135
					int port = -1;
136
					try {
137
						port = Integer.parseInt(connector.getPort());
138
					} catch (Exception e) {
139
						// ignore
140
					}
141
					String protocol = connector.getProtocol();
142
					if (protocol != null && protocol.length() > 0) {
143
						if (protocol.startsWith("HTTP")) {
144
							name = protocol;
145
						}
146
						else if (protocol.startsWith("AJP")) {
147
							name = protocol;
148
							protocol2 = "AJP"; 
149
						}
150
						else {
151
							// Get Tomcat equivalent name if protocol handler class specified
152
							name = (String)protocolHandlerMap.get(protocol);
153
							if (name != null) {
154
								// Prepare simple protocol string for ServerPort protocol
155
								int index = name.indexOf('/');
156
								if (index > 0)
157
									protocol2 = name.substring(0, index);
158
								else
159
									protocol2 = name;
160
							}
161
							// Specified protocol is unknown, just use as is
162
							else {
163
								name = protocol;
164
								protocol2 = protocol;
165
							}
166
						}
167
					}
168
					if (protocol2.toLowerCase().equals("http"))
169
						contentTypes = new String[] { "web", "webservices" };
170
					String secure = connector.getSecure();
171
					if (secure != null && secure.length() > 0) {
172
						name = "SSL";
173
						protocol2 = "SSL";
174
					} else
175
						advanced = false;
176
					String portId;
177
					if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
178
						portId = Integer.toString(j);
179
					else
180
						portId = i +"/" + j;
181
					ports.add(new ServerPort(portId, name, port, protocol2, contentTypes, advanced));
182
				}
183
			}
184
		} catch (Exception e) {
185
			Trace.trace(Trace.SEVERE, "Error getting server ports", e);
186
		}
187
		return ports;
188
	}
189
	
190
	/**
191
	 * Return a list of the web modules in this server.
192
	 * @return java.util.List
193
	 */
194
	public List getWebModules() {
195
		List list = new ArrayList();
196
	
197
		try {
198
			Context [] contexts = serverInstance.getContexts();
199
			if (contexts != null) {
200
				for (int i = 0; i < contexts.length; i++) {
201
					Context context = contexts[i];
202
					String reload = context.getReloadable();
203
					if (reload == null)
204
						reload = "false";
205
					WebModule module = new WebModule(context.getPath(), 
206
						context.getDocBase(), context.getSource(),
207
						reload.equalsIgnoreCase("true") ? true : false);
208
					list.add(module);
209
				}
210
			}
211
		} catch (Exception e) {
212
			Trace.trace(Trace.SEVERE, "Error getting project refs", e);
213
		}
214
		return list;
215
	}
216
	
217
	/**
218
	 * @see TomcatConfiguration#getServerWorkDirectory(IPath)
219
	 */
220
	public IPath getServerWorkDirectory(IPath basePath) {
221
		return serverInstance.getHostWorkDirectory(basePath);
222
	}
223
224
	/**
225
	 * @see TomcatConfiguration#getContextWorkDirectory(IPath, ITomcatWebModule)
226
	 */
227
	public IPath getContextWorkDirectory(IPath basePath, ITomcatWebModule module) {
228
		Context context = serverInstance.getContext(module.getPath());
229
		if (context != null)
230
			return serverInstance.getContextWorkDirectory(basePath, context);
231
		
232
		return null;
233
	}
234
235
	/**
236
	 * @see TomcatConfiguration#load(IPath, IProgressMonitor)
237
	 */
238
	public void load(IPath path, IProgressMonitor monitor) throws CoreException {
239
		try {
240
			monitor = ProgressUtil.getMonitorFor(monitor);
241
			monitor.beginTask(Messages.loadingTask, 7);
242
			
243
			// check for catalina.policy to verify that this is a v5.5 config
244
			InputStream in = new FileInputStream(path.append("catalina.policy").toFile());
245
			in.read();
246
			in.close();
247
			monitor.worked(1);
248
249
			serverFactory = new Factory();
250
			serverFactory.setPackageName("org.eclipse.jst.server.tomcat.core.internal.xml.server40");
251
			server = (Server) serverFactory.loadDocument(new FileInputStream(path.append("server.xml").toFile()));
252
			serverInstance = new ServerInstance(server, null, null);
253
			monitor.worked(1);
254
255
			webAppDocument = new WebAppDocument(path.append("web.xml"));
256
			monitor.worked(1);
257
			
258
			File file = path.append("context.xml").toFile();
259
			if (file.exists())
260
				contextDocument = XMLUtil.getDocumentBuilder().parse(new InputSource(new FileInputStream(file)));
261
			monitor.worked(1);
262
			
263
			tomcatUsersDocument = XMLUtil.getDocumentBuilder().parse(new InputSource(new FileInputStream(path.append("tomcat-users.xml").toFile())));
264
			monitor.worked(1);
265
			
266
			// load policy file
267
			policyFile = TomcatVersionHelper.getFileContents(new FileInputStream(path.append("catalina.policy").toFile()));
268
			monitor.worked(1);
269
270
			// load properties file
271
			file = path.append("catalina.properties").toFile();
272
			if (file.exists())
273
				propertiesFile = TomcatVersionHelper.getFileContents(new FileInputStream(file));
274
			else
275
				propertiesFile = null;
276
			monitor.worked(1);
277
			
278
			if (monitor.isCanceled())
279
				return;
280
			monitor.done();
281
		} catch (Exception e) {
282
			Trace.trace(Trace.WARNING, "Could not load Tomcat v5.5 configuration from " + path.toOSString() + ": " + e.getMessage());
283
			throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotLoadConfiguration, path.toOSString()), e));
284
		}
285
	}
286
287
	/**
288
	 * @see TomcatConfiguration#importFromPath(IPath, boolean, IProgressMonitor)
289
	 */
290
	public void importFromPath(IPath path, boolean isTestEnv, IProgressMonitor monitor) throws CoreException {
291
		load(path, monitor);
292
		
293
		// for test environment, remove existing contexts since a separate
294
		// catalina.base will be used
295
		if (isTestEnv) {
296
			while (serverInstance.removeContext(0)) {
297
				// no-op
298
			}
299
		}
300
	}
301
302
	/**
303
	 * @see TomcatConfiguration#load(IFolder, IProgressMonitor)
304
	 */
305
	public void load(IFolder folder, IProgressMonitor monitor) throws CoreException {
306
		try {
307
			monitor = ProgressUtil.getMonitorFor(monitor);
308
			monitor.beginTask(Messages.loadingTask, 1200);
309
	
310
			// check for catalina.policy to verify that this is a v4.0 config
311
			IFile file = folder.getFile("catalina.policy");
312
			if (!file.exists())
313
				throw new CoreException(new Status(IStatus.WARNING, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotLoadConfiguration, folder.getFullPath().toOSString()), null));
314
	
315
			// load server.xml
316
			file = folder.getFile("server.xml");
317
			InputStream in = file.getContents();
318
			serverFactory = new Factory();
319
			serverFactory.setPackageName("org.eclipse.jst.server.tomcat.core.internal.xml.server40");
320
			server = (Server) serverFactory.loadDocument(in);
321
			serverInstance = new ServerInstance(server, null, null);
322
			monitor.worked(200);
323
	
324
			// load web.xml
325
			file = folder.getFile("web.xml");
326
			webAppDocument = new WebAppDocument(file);
327
			monitor.worked(200);
328
	
329
			// load context.xml
330
			file = folder.getFile("context.xml");
331
			if (file.exists()) {
332
				in = file.getContents();
333
				contextDocument = XMLUtil.getDocumentBuilder().parse(new InputSource(in));
334
			}
335
			else
336
				contextDocument = null;
337
			monitor.worked(200);
338
		
339
			// load tomcat-users.xml
340
			file = folder.getFile("tomcat-users.xml");
341
			in = file.getContents();
342
			
343
			tomcatUsersDocument = XMLUtil.getDocumentBuilder().parse(new InputSource(in));
344
			monitor.worked(200);
345
		
346
			// load catalina.policy
347
			file = folder.getFile("catalina.policy");
348
			in = file.getContents();
349
			policyFile = TomcatVersionHelper.getFileContents(in);
350
			monitor.worked(200);
351
	
352
			// load catalina.properties
353
			file = folder.getFile("catalina.properties");
354
			if (file.exists()) {
355
				in = file.getContents();
356
				propertiesFile = TomcatVersionHelper.getFileContents(in);
357
			}
358
			else
359
				propertiesFile = null;
360
			monitor.worked(200);
361
			
362
			if (monitor.isCanceled())
363
				throw new Exception("Cancelled");
364
			monitor.done();
365
		} catch (Exception e) {
366
			Trace.trace(Trace.WARNING, "Could not reload Tomcat v5.5 configuration from: " + folder.getFullPath() + ": " + e.getMessage());
367
			throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotLoadConfiguration, folder.getFullPath().toOSString()), e));
368
		}
369
	}
370
371
	/**
372
	 * Save to the given directory.
373
	 * @param path a path
374
	 * @param forceDirty boolean
375
	 * @param monitor a progress monitor
376
	 * @exception CoreException
377
	 */
378
	protected void save(IPath path, boolean forceDirty, IProgressMonitor monitor) throws CoreException {
379
		try {
380
			monitor = ProgressUtil.getMonitorFor(monitor);
381
			monitor.beginTask(Messages.savingTask, 5);
382
			
383
			// make sure directory exists
384
			if (!path.toFile().exists()) {
385
				forceDirty = true;
386
				path.toFile().mkdir();
387
			}
388
			monitor.worked(1);
389
			
390
			// save files
391
			if (forceDirty || isServerDirty) {
392
				serverFactory.save(path.append("server.xml").toOSString());
393
				isServerDirty = false;
394
			}
395
			monitor.worked(1);
396
			
397
			webAppDocument.save(path.append("web.xml").toOSString(), forceDirty);
398
			monitor.worked(1);
399
			
400
			if (forceDirty && contextDocument != null)
401
				XMLUtil.save(path.append("context.xml").toOSString(), contextDocument);
402
			monitor.worked(1);
403
			
404
			if (forceDirty)
405
				XMLUtil.save(path.append("tomcat-users.xml").toOSString(), tomcatUsersDocument);
406
			monitor.worked(1);
407
			
408
			if (forceDirty) {
409
				BufferedWriter bw = new BufferedWriter(new FileWriter(path.append("catalina.policy").toFile()));
410
				bw.write(policyFile);
411
				bw.close();
412
			}
413
			monitor.worked(1);
414
			if (propertiesFile != null && forceDirty) {
415
				BufferedWriter bw = new BufferedWriter(new FileWriter(path.append("catalina.properties").toFile()));
416
				bw.write(propertiesFile);
417
				bw.close();
418
			}
419
			monitor.worked(1);
420
			
421
			if (monitor.isCanceled())
422
				return;
423
			monitor.done();
424
		} catch (Exception e) {
425
			Trace.trace(Trace.SEVERE, "Could not save Tomcat v5.5 configuration to " + path, e);
426
			throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotSaveConfiguration, new String[] {e.getLocalizedMessage()}), e));
427
		}
428
	}
429
430
	/**
431
	 * Save to the given directory.  All configuration files
432
	 * are forced to be saved.
433
	 * 
434
	 * @param path Desination path for the configuration files.
435
	 * @param monitor A progress monitor
436
	 * @exception CoreException
437
	 */
438
	public void save(IPath path, IProgressMonitor monitor) throws CoreException {
439
		save(path, true, monitor);
440
	}
441
442
	/**
443
	 * Save the information held by this object to the given directory.
444
	 *
445
	 * @param folder a folder
446
	 * @param monitor a progress monitor
447
	 * @throws CoreException
448
	 */
449
	public void save(IFolder folder, IProgressMonitor monitor) throws CoreException {
450
		try {
451
			monitor = ProgressUtil.getMonitorFor(monitor);
452
			monitor.beginTask(Messages.savingTask, 1200);
453
	
454
			// save server.xml
455
			byte[] data = serverFactory.getContents();
456
			InputStream in = new ByteArrayInputStream(data);
457
			IFile file = folder.getFile("server.xml");
458
			if (file.exists()) {
459
				if (isServerDirty)
460
					file.setContents(in, true, true, ProgressUtil.getSubMonitorFor(monitor, 200));
461
				else
462
					monitor.worked(200);
463
			} else
464
				file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 200));
465
			isServerDirty = false;
466
			
467
			// save web.xml
468
			webAppDocument.save(folder.getFile("web.xml"), ProgressUtil.getSubMonitorFor(monitor, 200));
469
			
470
			// save context.xml
471
			if (contextDocument != null) {
472
				data = XMLUtil.getContents(contextDocument);
473
				in = new ByteArrayInputStream(data);
474
				file = folder.getFile("context.xml");
475
				if (file.exists())
476
					monitor.worked(200);
477
					//file.setContents(in, true, true, ProgressUtil.getSubMonitorFor(monitor, 200));
478
				else
479
					file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 200));
480
			}
481
			
482
			// save tomcat-users.xml
483
			data = XMLUtil.getContents(tomcatUsersDocument);
484
			in = new ByteArrayInputStream(data);
485
			file = folder.getFile("tomcat-users.xml");
486
			if (file.exists())
487
				monitor.worked(200);
488
				//file.setContents(in, true, true, ProgressUtil.getSubMonitorFor(monitor, 200));
489
			else
490
				file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 200));
491
			
492
			// save catalina.policy
493
			in = new ByteArrayInputStream(policyFile.getBytes());
494
			file = folder.getFile("catalina.policy");
495
			if (file.exists())
496
				monitor.worked(200);
497
				//file.setContents(in, true, true, ProgressUtil.getSubMonitorFor(monitor, 200));
498
			else
499
				file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 200));
500
			
501
			// save catalina.properties
502
			if (propertiesFile != null) {
503
				in = new ByteArrayInputStream(propertiesFile.getBytes());
504
				file = folder.getFile("catalina.properties");
505
				if (file.exists())
506
					monitor.worked(200);
507
					//file.setContents(in, true, true, ProgressUtil.getSubMonitorFor(monitor, 200));
508
				else
509
					file.create(in, true, ProgressUtil.getSubMonitorFor(monitor, 200));
510
			} else
511
				monitor.worked(200);
512
			
513
			if (monitor.isCanceled())
514
				return;
515
			monitor.done();
516
		} catch (Exception e) {
517
			Trace.trace(Trace.SEVERE, "Could not save Tomcat v5.5 configuration to " + folder.toString(), e);
518
			throw new CoreException(new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotSaveConfiguration, new String[] {e.getLocalizedMessage()}), e));
519
		}
520
	}
521
522
	protected static boolean hasMDBListener(Server server) {
523
		if (server == null)
524
			return false;
525
		
526
		int count = server.getListenerCount();
527
		if (count == 0)
528
			return false;
529
			
530
		for (int i = 0; i < count; i++) {
531
			Listener listener = server.getListener(i);
532
			if (listener != null && listener.getClassName() != null && listener.getClassName().indexOf("mbean") >= 0)
533
				return true;
534
		}
535
		return false;
536
	}
537
	
538
	/**
539
	 * @see ITomcatConfigurationWorkingCopy#addMimeMapping(int, IMimeMapping)
540
	 */
541
	public void addMimeMapping(int index, IMimeMapping map) {
542
		webAppDocument.addMimeMapping(index, map);
543
		firePropertyChangeEvent(ADD_MAPPING_PROPERTY, new Integer(index), map);
544
	}
545
546
	/**
547
	 * @see ITomcatConfigurationWorkingCopy#addWebModule(int, ITomcatWebModule)
548
	 */
549
	public void addWebModule(int index, ITomcatWebModule module) {
550
		try {
551
			Context context = serverInstance.createContext(index);
552
			if (context != null) {
553
				context.setDocBase(module.getDocumentBase());
554
				context.setPath(module.getPath());
555
				context.setReloadable(module.isReloadable() ? "true" : "false");
556
				if (module.getMemento() != null && module.getMemento().length() > 0)
557
					context.setSource(module.getMemento());
558
				isServerDirty = true;
559
				firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
560
			}
561
		} catch (Exception e) {
562
			Trace.trace(Trace.SEVERE, "Error adding web module " + module.getPath(), e);
563
		}
564
	}
565
566
	/**
567
	 * Change the extension of a mime mapping.
568
	 * 
569
	 * @param index
570
	 * @param map
571
	 */
572
	public void modifyMimeMapping(int index, IMimeMapping map) {
573
		webAppDocument.modifyMimeMapping(index, map);
574
		firePropertyChangeEvent(MODIFY_MAPPING_PROPERTY, new Integer(index), map);
575
	}
576
577
	/**
578
	 * Modify the port with the given id.
579
	 *
580
	 * @param id java.lang.String
581
	 * @param port int
582
	 */
583
	public void modifyServerPort(String id, int port) {
584
		try {
585
			if ("server".equals(id)) {
586
				server.setPort(port + "");
587
				isServerDirty = true;
588
				firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
589
				return;
590
			}
591
	
592
			int i = id.indexOf("/");
593
			// If a connector in the instance Service
594
			if (i < 0) {
595
				int connNum = Integer.parseInt(id);
596
				Connector connector = serverInstance.getConnector(connNum);
597
				if (connector != null) {
598
					connector.setPort(port + "");
599
					isServerDirty = true;
600
					firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
601
				}
602
			}
603
			// Else a connector in another Service
604
			else {
605
				int servNum = Integer.parseInt(id.substring(0, i));
606
				int connNum = Integer.parseInt(id.substring(i + 1));
607
				
608
				Service service = server.getService(servNum);
609
				Connector connector = service.getConnector(connNum);
610
				connector.setPort(port + "");
611
				isServerDirty = true;
612
				firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
613
			}
614
		} catch (Exception e) {
615
			Trace.trace(Trace.SEVERE, "Error modifying server port " + id, e);
616
		}
617
	}
618
	/**
619
	 * Change a web module.
620
	 * @param index int
621
	 * @param docBase java.lang.String
622
	 * @param path java.lang.String
623
	 * @param reloadable boolean
624
	 */
625
	public void modifyWebModule(int index, String docBase, String path, boolean reloadable) {
626
		try {
627
			Context context = serverInstance.getContext(index);
628
			if (context != null) {
629
				context.setPath(path);
630
				context.setDocBase(docBase);
631
				context.setReloadable(reloadable ? "true" : "false");
632
				isServerDirty = true;
633
				WebModule module = new WebModule(path, docBase, null, reloadable);
634
				firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, new Integer(index), module);
635
			}
636
		} catch (Exception e) {
637
			Trace.trace(Trace.SEVERE, "Error modifying web module " + index, e);
638
		}
639
	}
640
641
	/**
642
	 * Removes a mime mapping.
643
	 * @param index int
644
	 */
645
	public void removeMimeMapping(int index) {
646
		webAppDocument.removeMimeMapping(index);
647
		firePropertyChangeEvent(REMOVE_MAPPING_PROPERTY, null, new Integer(index));
648
	}
649
650
	/**
651
	 * Removes a web module.
652
	 * @param index int
653
	 */
654
	public void removeWebModule(int index) {
655
		try {
656
			serverInstance.removeContext(index);
657
			isServerDirty = true;
658
			firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY, null, new Integer(index));
659
		} catch (Exception e) {
660
			Trace.trace(Trace.SEVERE, "Error removing module ref " + index, e);
661
		}
662
	}
663
664
	/**
665
	 * Add context configuration found in META-INF/context.xml files
666
	 * present in projects to published server.xml.
667
	 * 
668
	 * @param baseDir path to catalina instance directory
669
	 * @param deployDir path to deployment directory
670
	 * @param monitor a progress monitor or null
671
	 * @return result of operation
672
	 */
673
	protected IStatus publishContextConfig(IPath baseDir, IPath deployDir, IProgressMonitor monitor) {
674
		return TomcatVersionHelper.publishCatalinaContextConfig(baseDir, deployDir, monitor);
675
	}
676
	
677
	/**
678
	 * Update contexts in server.xml to serve projects directly without
679
	 * publishing.
680
	 * 
681
	 * @param baseDir path to catalina instance directory
682
	 * @param monitor a progress monitor or null
683
	 * @return result of operation
684
	 */
685
	protected IStatus updateContextsToServeDirectly(IPath baseDir, String loader, IProgressMonitor monitor) {
686
		return TomcatVersionHelper.updateContextsToServeDirectly(baseDir, loader, monitor);
687
	}
688
689
	/**
690
	 * Cleanup the server instance.  This consists of deleting the work
691
	 * directory associated with Contexts that are going away in the
692
	 * up coming publish.
693
	 * 
694
	 * @param baseDir path to server instance directory, i.e. catalina.base
695
	 * @param installDir path to server installation directory (not currently used)
696
	 * @param monitor a progress monitor or null
697
	 * @return MultiStatus containing results of the cleanup operation
698
	 */
699
	protected IStatus cleanupServer(IPath baseDir, IPath installDir, boolean removeKeptContextFiles, IProgressMonitor monitor) {
700
		List modules = getWebModules();
701
		return TomcatVersionHelper.cleanupCatalinaServer(baseDir, installDir, removeKeptContextFiles, modules, monitor);
702
	}
703
704
	/**
705
	 * @see TomcatConfiguration#localizeConfiguration(IPath, IPath, TomcatServer, IProgressMonitor)
706
	 */
707
	public IStatus localizeConfiguration(IPath baseDir, IPath deployDir, TomcatServer tomcatServer, IProgressMonitor monitor) {
708
		return TomcatVersionHelper.localizeConfiguration(baseDir, deployDir, tomcatServer, monitor);
709
	}
710
}
(-)tomcatcore/org/eclipse/jst/server/tomcat/core/internal/Tomcat70Handler.java (+199 lines)
Added Link Here
1
/**********************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *    IBM Corporation - Initial API and implementation
10
 **********************************************************************/
11
package org.eclipse.jst.server.tomcat.core.internal;
12
13
import java.util.ArrayList;
14
import java.util.List;
15
16
import org.eclipse.core.runtime.IPath;
17
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Status;
19
import org.eclipse.jdt.launching.JavaRuntime;
20
import org.eclipse.wst.server.core.IModule;
21
/**
22
 * Tomcat 70 handler.
23
 */
24
public class Tomcat70Handler implements ITomcatVersionHandler {
25
	/**
26
	 * @see ITomcatVersionHandler#verifyInstallPath(IPath)
27
	 */
28
	public IStatus verifyInstallPath(IPath installPath) {
29
		IStatus result = TomcatVersionHelper.checkCatalinaVersion(installPath, TomcatPlugin.TOMCAT_70);
30
		// If check was canceled, use folder check
31
		if (result.getSeverity() == IStatus.CANCEL) {
32
			result = TomcatPlugin.verifyInstallPathWithFolderCheck(installPath, TomcatPlugin.TOMCAT_70);
33
		}
34
		return result;
35
	}
36
	
37
	/**
38
	 * @see ITomcatVersionHandler#getRuntimeClass()
39
	 */
40
	public String getRuntimeClass() {
41
		return "org.apache.catalina.startup.Bootstrap";
42
	}
43
	
44
	/**
45
	 * @see ITomcatVersionHandler#getRuntimeClasspath(IPath)
46
	 */
47
	public List getRuntimeClasspath(IPath installPath) {
48
		List cp = new ArrayList();
49
		
50
		// 7.0 - add bootstrap.jar and tomcat-juli.jar from the Tomcat bin directory
51
		IPath binPath = installPath.append("bin");
52
		if (binPath.toFile().exists()) {
53
			IPath path = binPath.append("bootstrap.jar");
54
			cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
55
			// Add tomcat-juli.jar if it exists
56
			path = binPath.append("tomcat-juli.jar");
57
			if (path.toFile().exists()) {
58
				cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
59
			}
60
		}
61
		
62
		return cp;
63
	}
64
65
	/**
66
	 * @see ITomcatVersionHandler#getRuntimeProgramArguments(IPath, boolean, boolean)
67
	 */
68
	public String[] getRuntimeProgramArguments(IPath configPath, boolean debug, boolean starting) {
69
		List list = new ArrayList();
70
71
		if (starting)
72
			list.add("start");
73
		else
74
			list.add("stop");
75
		
76
		String[] temp = new String[list.size()];
77
		list.toArray(temp);
78
		return temp;
79
	}
80
81
	/**
82
	 * @see ITomcatVersionHandler#getExcludedRuntimeProgramArguments(boolean, boolean)
83
	 */
84
	public String[] getExcludedRuntimeProgramArguments(boolean debug, boolean starting) {
85
		return null;
86
	}
87
	
88
	/**
89
	 * @see ITomcatVersionHandler#getRuntimeVMArguments(IPath, IPath, IPath, boolean)
90
	 */
91
	public String[] getRuntimeVMArguments(IPath installPath, IPath configPath, IPath deployPath, boolean isTestEnv) {
92
		return TomcatVersionHelper.getCatalinaVMArguments(installPath, configPath, deployPath, getEndorsedDirectories(installPath), isTestEnv);
93
	}
94
95
	/**
96
	 * @see ITomcatVersionHandler#getRuntimePolicyFile(IPath)
97
	 */
98
	public String getRuntimePolicyFile(IPath configPath) {
99
		return configPath.append("conf").append("catalina.policy").toOSString();
100
	}
101
102
	/**
103
	 * @see ITomcatVersionHandler#canAddModule(IModule)
104
	 */
105
	public IStatus canAddModule(IModule module) {
106
		String version = module.getModuleType().getVersion();
107
		if ("2.2".equals(version) || "2.3".equals(version) || "2.4".equals(version) || "2.5".equals(version)
108
				|| "3.0".equals(version))
109
			return Status.OK_STATUS;
110
		
111
		return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, Messages.errorSpec70, null);
112
	}
113
114
	/**
115
	 * @see ITomcatVersionHandler#getRuntimeBaseDirectory(TomcatServer)
116
	 */
117
	public IPath getRuntimeBaseDirectory(TomcatServer server) {
118
		return TomcatVersionHelper.getStandardBaseDirectory(server);
119
	}
120
121
	/**
122
	 * @see ITomcatVersionHandler#prepareRuntimeDirectory(IPath)
123
	 */
124
	public IStatus prepareRuntimeDirectory(IPath baseDir) {
125
		return TomcatVersionHelper.createCatalinaInstanceDirectory(baseDir);
126
	}
127
128
	/**
129
	 * @see ITomcatVersionHandler#prepareDeployDirectory(IPath)
130
	 */
131
	public IStatus prepareDeployDirectory(IPath deployPath) {
132
		return TomcatVersionHelper.createDeploymentDirectory(deployPath,
133
				TomcatVersionHelper.DEFAULT_WEBXML_SERVLET25);
134
	}
135
136
	/**
137
	 * @see ITomcatVersionHandler#prepareForServingDirectly(IPath, TomcatServer)
138
	 */
139
	public IStatus prepareForServingDirectly(IPath baseDir, TomcatServer server) {
140
		IStatus status;
141
		// If serving modules without publishing, loader jar is needed
142
		// TODO Need to examine catalina.properties to ensure loader jar and catalina.properties are handled appropriately
143
		if (server.isServeModulesWithoutPublish()) {
144
			status = TomcatVersionHelper.copyLoaderJar(
145
					getRuntimeBaseDirectory(server).append("lib"),
146
					server.getServer().getRuntime().getRuntimeType().getId());
147
			// If copy successful and running a separate server instance, modify catalina.properties
148
			if (status.isOK() && server.isTestEnvironment()) {
149
				status = TomcatVersionHelper.updatePropertiesToServeDirectly(baseDir, "lib", "common");
150
			}
151
		}
152
		// Else ensure jar is removed
153
		else {
154
			TomcatVersionHelper.removeLoaderJar(
155
					getRuntimeBaseDirectory(server).append("lib"),
156
					server.getServer().getRuntime().getRuntimeType().getId());
157
			// TODO Decide what to do with removal warning, maybe nothing
158
			status = Status.OK_STATUS;
159
		}
160
		return status;
161
	}
162
163
	/**
164
	 * @see ITomcatVersionHandler#getSharedLoader(IPath)
165
	 */
166
	public String getSharedLoader(IPath baseDir) {
167
		return "common";
168
	}
169
	
170
	/**
171
	 * Returns true since Tomcat 6.x supports this feature.
172
	 * 
173
	 * @return true since feature is supported
174
	 */
175
	public boolean supportsServeModulesWithoutPublish() {
176
		return true;
177
	}
178
179
	/**
180
	 * @see ITomcatVersionHandler#supportsDebugArgument()
181
	 */
182
	public boolean supportsDebugArgument() {
183
		return false;
184
	}
185
186
	/**
187
	 * @see ITomcatVersionHandler#supportsSeparateContextFiles()
188
	 */
189
	public boolean supportsSeparateContextFiles() {
190
		return true;
191
	}
192
193
	/**
194
	 * @see ITomcatVersionHandler#getEndorsedDirectories(IPath)
195
	 */
196
	public String getEndorsedDirectories(IPath installPath) {
197
		return installPath.append("endorsed").toOSString();
198
	}	
199
}

Return to bug 308916