773 lines
35 KiB
Diff
773 lines
35 KiB
Diff
### Eclipse Workspace Patch 1.0
|
|
#P org.eclipse.tomcat
|
|
Index: .classpath
|
|
===================================================================
|
|
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/.classpath,v
|
|
retrieving revision 1.21
|
|
diff -u -r1.21 .classpath
|
|
--- .classpath 9 May 2006 18:51:41 -0000 1.21
|
|
+++ .classpath 16 Nov 2007 16:03:10 -0000
|
|
@@ -1,28 +1,35 @@
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<classpath>
|
|
<classpathentry kind="src" path="src"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="catalina.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="bootstrap.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="commons-beanutils.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="commons-collections.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="commons-digester.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="commons-logging-api.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="commons-modeler.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="jakarta-regexp-1.3.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="jasper-compiler.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="jasper-runtime.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="mx4j-jmx.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="naming-common.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="naming-factory.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="naming-resources.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="servlet.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="servlets-common.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="servlets-default.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="servlets-invoker.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="servlets-manager.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="tomcat-coyote.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="tomcat-http11.jar"/>
|
|
- <classpathentry exported="true" sourcepath="D:/tomcat4.1.30src" kind="lib" path="tomcat-util.jar"/>
|
|
+ <classpathentry exported="true" kind="lib" path="catalina.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="bootstrap.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="commons-beanutils.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="commons-collections.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="commons-digester.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="commons-logging-api.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="commons-modeler.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="mx4j-jmx.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="naming-factory.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="naming-resources.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="servlets-default.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="servlets-invoker.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="tomcat-coyote.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry exported="true" kind="lib" path="tomcat-util.jar" sourcepath="D:/tomcat4.1.30src"/>
|
|
+ <classpathentry kind="lib" path="catalina-optional.jar"/>
|
|
+ <classpathentry kind="lib" path="commons-dbcp.jar"/>
|
|
+ <classpathentry kind="lib" path="commons-digester-rss.jar"/>
|
|
+ <classpathentry kind="lib" path="commons-el.jar"/>
|
|
+ <classpathentry kind="lib" path="commons-fileupload.jar"/>
|
|
+ <classpathentry kind="lib" path="commons-launcher.jar"/>
|
|
+ <classpathentry kind="lib" path="commons-pool.jar"/>
|
|
+ <classpathentry kind="lib" path="jasper5-compiler.jar"/>
|
|
+ <classpathentry kind="lib" path="jasper5-runtime.jar"/>
|
|
+ <classpathentry kind="lib" path="jspapi.jar"/>
|
|
+ <classpathentry kind="lib" path="mx4j.jar"/>
|
|
+ <classpathentry kind="lib" path="mx4j-impl.jar"/>
|
|
+ <classpathentry kind="lib" path="regexp.jar"/>
|
|
+ <classpathentry kind="lib" path="servletapi5.jar"/>
|
|
+ <classpathentry kind="lib" path="tomcat-http.jar"/>
|
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
<classpathentry kind="output" path="bin"/>
|
|
Index: src/org/eclipse/tomcat/internal/TomcatPlugin.java
|
|
===================================================================
|
|
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/src/org/eclipse/tomcat/internal/TomcatPlugin.java,v
|
|
retrieving revision 1.24
|
|
diff -u -r1.24 TomcatPlugin.java
|
|
--- src/org/eclipse/tomcat/internal/TomcatPlugin.java 23 May 2005 03:58:20 -0000 1.24
|
|
+++ src/org/eclipse/tomcat/internal/TomcatPlugin.java 16 Nov 2007 16:03:10 -0000
|
|
@@ -24,13 +24,16 @@
|
|
public final static String PREF_ACCEPT_COUNT = "acceptCount"; //$NON-NLS-1$
|
|
public final static String PREF_MAX_PROCESSORS = "maxProcessors"; //$NON-NLS-1$
|
|
public final static String PREF_MIN_PROCESSORS = "minProcessors"; //$NON-NLS-1$
|
|
+ public final static String DISABLE_UPLOAD_TIMEOUT = "disableUploadTimeout"; //$NON-NLS-1$
|
|
|
|
public final static String PREF_SSL_PORT = "sslPort"; //$NON-NLS-1$
|
|
public final static String PREF_SSL_PROTOCOL = "sslProtocol"; //$NON-NLS-1$
|
|
+ public final static String PREF_SSL_PROTOCOLS = "sslProtocols"; //$NON-NLS-1$
|
|
public final static String PREF_SSL_SCHEME = "sslScheme"; //$NON-NLS-1$
|
|
public final static String PREF_SSL_ALGORITHM = "sslAlgorithm"; //$NON-NLS-1$
|
|
public final static String PREF_KEY_STORE_FILE = "keyStoreFile"; //$NON-NLS-1$
|
|
public final static String PREF_KEY_STORE_PASSWORD = "keyStorePassword"; //$NON-NLS-1$
|
|
+ public final static String PREF_CLIENT_AUTHENTICATION = "clientauth"; //$NON-NLS-1$
|
|
|
|
private static TomcatPlugin plugin;
|
|
// private static BundleContext bundleContext;
|
|
Index: src/org/eclipse/tomcat/internal/EclipseErrorReportValve.java
|
|
===================================================================
|
|
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/src/org/eclipse/tomcat/internal/EclipseErrorReportValve.java,v
|
|
retrieving revision 1.9
|
|
diff -u -r1.9 EclipseErrorReportValve.java
|
|
--- src/org/eclipse/tomcat/internal/EclipseErrorReportValve.java 23 Feb 2006 22:51:14 -0000 1.9
|
|
+++ src/org/eclipse/tomcat/internal/EclipseErrorReportValve.java 16 Nov 2007 16:03:10 -0000
|
|
@@ -68,16 +68,27 @@
|
|
|
|
package org.eclipse.tomcat.internal;
|
|
|
|
-
|
|
-import java.io.*;
|
|
-import java.util.*;
|
|
-
|
|
-import javax.servlet.*;
|
|
-import javax.servlet.http.*;
|
|
-
|
|
-import org.apache.catalina.*;
|
|
-import org.apache.catalina.util.*;
|
|
-import org.apache.catalina.valves.*;
|
|
+import java.io.IOException;
|
|
+import java.io.PrintWriter;
|
|
+import java.io.StringWriter;
|
|
+import java.io.Writer;
|
|
+import java.util.Locale;
|
|
+
|
|
+import javax.servlet.ServletException;
|
|
+import javax.servlet.ServletResponse;
|
|
+import javax.servlet.ServletRequest;
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
+
|
|
+import mx4j.log.Logger;
|
|
+
|
|
+import org.apache.catalina.Globals;
|
|
+import org.apache.catalina.Valve;
|
|
+import org.apache.catalina.connector.Request;
|
|
+import org.apache.catalina.connector.Response;
|
|
+import org.apache.catalina.util.RequestUtil;
|
|
+import org.apache.catalina.util.StringManager;
|
|
+import org.apache.catalina.valves.Constants;
|
|
+import org.apache.catalina.valves.ValveBase;
|
|
import org.eclipse.core.runtime.Platform;
|
|
|
|
|
|
@@ -145,12 +156,12 @@
|
|
* @exception IOException if an input/output error occurs
|
|
* @exception ServletException if a servlet error occurs
|
|
*/
|
|
- public void invoke(Request request, Response response,
|
|
- ValveContext context)
|
|
+ public void invoke(Request request, Response response)
|
|
throws IOException, ServletException {
|
|
|
|
// Perform the request
|
|
- context.invokeNext(request, response);
|
|
+ Valve nextValve = getNext();
|
|
+ nextValve.invoke(request, response);
|
|
|
|
ServletRequest sreq = (ServletRequest) request;
|
|
Throwable throwable =
|
|
@@ -220,14 +231,11 @@
|
|
throws IOException {
|
|
|
|
// Do nothing on non-HTTP responses
|
|
- if (!(response instanceof HttpResponse))
|
|
- return;
|
|
- HttpResponse hresponse = (HttpResponse) response;
|
|
if (!(response instanceof HttpServletResponse))
|
|
return;
|
|
HttpServletResponse hres = (HttpServletResponse) response;
|
|
- int statusCode = hresponse.getStatus();
|
|
- String message = RequestUtil.filter(hresponse.getMessage());
|
|
+ int statusCode = response.getStatus();
|
|
+ String message = RequestUtil.filter(response.getMessage());
|
|
if (message == null)
|
|
message = ""; //$NON-NLS-1$
|
|
|
|
@@ -373,9 +381,9 @@
|
|
*/
|
|
protected void log(String message) {
|
|
|
|
- Logger logger = container.getLogger();
|
|
+ Logger logger = (Logger) container.getLogger();
|
|
if (logger != null)
|
|
- logger.log(this.toString() + ": " + message); //$NON-NLS-1$
|
|
+ logger.info(this.toString() + ": " + message); //$NON-NLS-1$
|
|
else
|
|
System.out.println(this.toString() + ": " + message); //$NON-NLS-1$
|
|
|
|
@@ -390,9 +398,9 @@
|
|
*/
|
|
protected void log(String message, Throwable throwable) {
|
|
|
|
- Logger logger = container.getLogger();
|
|
+ Logger logger = (Logger) container.getLogger();
|
|
if (logger != null)
|
|
- logger.log(this.toString() + ": " + message, throwable); //$NON-NLS-1$
|
|
+ logger.info(this.toString() + ": " + message, throwable); //$NON-NLS-1$
|
|
else {
|
|
System.out.println(this.toString() + ": " + message); //$NON-NLS-1$
|
|
throwable.printStackTrace(System.out);
|
|
Index: src/org/eclipse/tomcat/internal/TomcatAppServer.java
|
|
===================================================================
|
|
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/src/org/eclipse/tomcat/internal/TomcatAppServer.java,v
|
|
retrieving revision 1.46
|
|
diff -u -r1.46 TomcatAppServer.java
|
|
--- src/org/eclipse/tomcat/internal/TomcatAppServer.java 17 Apr 2006 15:24:57 -0000 1.46
|
|
+++ src/org/eclipse/tomcat/internal/TomcatAppServer.java 16 Nov 2007 16:03:10 -0000
|
|
@@ -4,7 +4,7 @@
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
* which accompanies this distribution, and is available at
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
- *
|
|
+ *
|
|
* Contributors:
|
|
* IBM Corporation - initial API and implementation
|
|
*******************************************************************************/
|
|
@@ -17,23 +17,22 @@
|
|
import java.net.UnknownHostException;
|
|
import java.util.ArrayList;
|
|
|
|
-import org.apache.catalina.Connector;
|
|
import org.apache.catalina.Context;
|
|
import org.apache.catalina.Engine;
|
|
import org.apache.catalina.Host;
|
|
+import org.apache.catalina.Lifecycle;
|
|
import org.apache.catalina.LifecycleEvent;
|
|
import org.apache.catalina.LifecycleException;
|
|
import org.apache.catalina.LifecycleListener;
|
|
import org.apache.catalina.Realm;
|
|
+import org.apache.catalina.connector.Connector;
|
|
import org.apache.catalina.core.StandardContext;
|
|
import org.apache.catalina.core.StandardHost;
|
|
-import org.apache.catalina.logger.FileLogger;
|
|
import org.apache.catalina.realm.MemoryRealm;
|
|
import org.apache.catalina.startup.Embedded;
|
|
-import org.apache.coyote.tomcat4.CoyoteConnector;
|
|
-import org.apache.coyote.tomcat4.CoyoteServerSocketFactory;
|
|
+import org.apache.coyote.http11.Http11Protocol;
|
|
+import org.apache.tomcat.util.net.jsse.JSSEImplementation;
|
|
import org.eclipse.core.runtime.CoreException;
|
|
-import org.eclipse.core.runtime.FileLocator;
|
|
import org.eclipse.core.runtime.IConfigurationElement;
|
|
import org.eclipse.core.runtime.IExtension;
|
|
import org.eclipse.core.runtime.IExtensionPoint;
|
|
@@ -56,6 +55,8 @@
|
|
* should not be used
|
|
*/
|
|
public final static int SSL_DISABLED = -1;
|
|
+
|
|
+ private final static String NULL = null;
|
|
|
|
private String hostAddress;
|
|
|
|
@@ -76,7 +77,9 @@
|
|
private Host host = null;
|
|
|
|
private Connector httpConnector = null;
|
|
+ private boolean hasConnection = false;
|
|
private Connector sslConnector = null;
|
|
+ private boolean hasSSLConnection = false;
|
|
// Con
|
|
private ArrayList contexts = new ArrayList();
|
|
|
|
@@ -92,24 +95,34 @@
|
|
* java.lang.String)
|
|
*/
|
|
public synchronized void start(int port, String hostAddress) throws CoreException {
|
|
- this.hostAddress = hostAddress;
|
|
+ // if null passed for hostAddress, use local host
|
|
+ if (hostAddress == null) {
|
|
+ this.hostAddress = "127.0.0.1"; //$NON-NLS-1$
|
|
+ } else {
|
|
+ this.hostAddress = hostAddress;
|
|
+ }
|
|
+ InetAddress iAddress = null;
|
|
+
|
|
+ //Defaults to LOCALHOST
|
|
+ try{
|
|
+ iAddress = InetAddress.getByName(this.hostAddress);
|
|
+ } catch (UnknownHostException uhe) {
|
|
+ // will default to all interfaces
|
|
+ }
|
|
+
|
|
+ String hostname = iAddress.getHostName();
|
|
+
|
|
this.port = port;
|
|
-
|
|
if (isStarted) {
|
|
return;
|
|
}
|
|
isStarted = true;
|
|
try {
|
|
- FileLogger logger = new FileLogger();
|
|
- logger.setDirectory(TomcatPlugin.getDefault().getStateLocation()
|
|
- .toOSString());
|
|
- embedded = new Embedded(logger, new MemoryRealm());
|
|
- embedded.setDebug(0);
|
|
- embedded.setLogger(logger);
|
|
+ embedded = new Embedded(new MemoryRealm());
|
|
URL installURL = TomcatPlugin.getDefault().getBundle()
|
|
.getEntry("/"); //$NON-NLS-1$
|
|
- URL resolvedURL = FileLocator.resolve(installURL);
|
|
- String home = FileLocator.toFileURL(resolvedURL).getFile();
|
|
+ URL resolvedURL = Platform.resolve(installURL);
|
|
+ String home = Platform.asLocalURL(resolvedURL).getFile();
|
|
System.setProperty("catalina.home", home); //$NON-NLS-1$
|
|
String base = home;
|
|
System.setProperty("catalina.base", base); //$NON-NLS-1$
|
|
@@ -120,14 +133,21 @@
|
|
Realm realm = getRealm();
|
|
embedded.setRealm(realm);
|
|
}
|
|
-
|
|
+ //the embedded application is now started by using embedded.start()
|
|
+ embedded.addLifecycleListener(new LifecycleListener(){
|
|
+ public void lifecycleEvent(LifecycleEvent event) {
|
|
+ if (Lifecycle.START_EVENT.equals(event.getType()))
|
|
+ running = true;
|
|
+ }
|
|
+
|
|
+ });
|
|
// start now, and then add all the contexts..
|
|
embedded.start();
|
|
|
|
// Create a very basic container hierarchy
|
|
engine = embedded.createEngine();
|
|
|
|
- host = embedded.createHost("localhost", home + "/webapps"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ host = embedded.createHost(hostname, home + "webapps"); //$NON-NLS-1$
|
|
|
|
// all request go to our only host
|
|
engine.setDefaultHost(host.getName());
|
|
@@ -136,8 +156,9 @@
|
|
((StandardHost) host)
|
|
.setErrorReportValveClass("org.eclipse.tomcat.internal.EclipseErrorReportValve"); //$NON-NLS-1$
|
|
}
|
|
+
|
|
engine.addChild(host);
|
|
-
|
|
+
|
|
// Install the assembled container hierarchy
|
|
PrintStream sysOut = System.out;
|
|
// reassign standard output to prevent Tomcat from writing
|
|
@@ -150,7 +171,7 @@
|
|
}
|
|
|
|
// Root context
|
|
- Context root = embedded.createContext("", home + "/webapps/ROOT"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ Context root = embedded.createContext("", home + "webapps/ROOT"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
// this line should be replaced once tomcat provides support
|
|
// for setting the working directory
|
|
if (root instanceof StandardContext) {
|
|
@@ -159,20 +180,13 @@
|
|
}
|
|
root.setLoader(embedded.createLoader(this.getClass()
|
|
.getClassLoader()));
|
|
- contexts.add(root);
|
|
+
|
|
host.addChild(root);
|
|
-
|
|
- InetAddress iAddress = null;
|
|
- if (this.hostAddress != null) {
|
|
- try {
|
|
- iAddress = InetAddress.getByName(this.hostAddress);
|
|
- } catch (UnknownHostException uhe) {
|
|
- // will default to all interfaces
|
|
- }
|
|
- }
|
|
+ contexts.add(root);
|
|
+
|
|
updateSslPort(iAddress);
|
|
if (this.port == 0) {
|
|
- this.port = SocketUtil.findUnusedLocalPort(iAddress);
|
|
+ this.port = SocketUtil.findUnusedLocalPort(iAddress);
|
|
if (this.port == -1) {
|
|
throw new CoreException(
|
|
new Status(
|
|
@@ -184,51 +198,55 @@
|
|
}
|
|
}
|
|
|
|
- // Create Connector
|
|
- Connector connector = embedded.createConnector(null, this.port,
|
|
- false);
|
|
- // Override defaults on CoyoteConnector
|
|
- if (connector instanceof CoyoteConnector) {
|
|
- CoyoteConnector connectorImpl = (CoyoteConnector) connector;
|
|
- if (iAddress != null) {
|
|
- // bug in Embedded that incorrectly sets host on connector.
|
|
- // pass null when creating connector, and set host here if
|
|
- // it is specified
|
|
- connectorImpl.setAddress(iAddress.getHostAddress());
|
|
- }
|
|
- Preferences pref = TomcatPlugin.getDefault()
|
|
- .getPluginPreferences();
|
|
- int acceptCount = pref.getInt(TomcatPlugin.PREF_ACCEPT_COUNT);
|
|
- if (acceptCount > 0) {
|
|
- connectorImpl.setAcceptCount(acceptCount);
|
|
- }
|
|
- int maxProcessors = pref
|
|
- .getInt(TomcatPlugin.PREF_MAX_PROCESSORS);
|
|
- if (maxProcessors > 0) {
|
|
- connectorImpl.setMaxProcessors(maxProcessors);
|
|
- }
|
|
- int minProcessors = pref
|
|
- .getInt(TomcatPlugin.PREF_MIN_PROCESSORS);
|
|
- if (minProcessors > 0) {
|
|
- connectorImpl.setMinProcessors(minProcessors);
|
|
- }
|
|
- if (this.sslPort > 0) {
|
|
- connectorImpl.setRedirectPort(this.sslPort);
|
|
- connectorImpl.setEnableLookups(true);
|
|
- connectorImpl.setConnectionTimeout(20000);
|
|
- connectorImpl.setUseURIValidationHack(false);
|
|
- connectorImpl.setDisableUploadTimeout(true);
|
|
+ // Create Connector
|
|
+ Connector connector = embedded.createConnector(iAddress.getHostAddress(), this.port,false);;
|
|
+
|
|
+ Preferences pref = TomcatPlugin.getDefault()
|
|
+ .getPluginPreferences();
|
|
+ /**
|
|
+ * To extend additional properties, make use of org.apache.tomcat.util.IntrospectionUtils
|
|
+ * A Connector will initialize a protocolhandler defaults to org.apache.coyote.http11.Http11Protocol
|
|
+ * format : connector.setProperty("STRING_PROP_NAME","STRING_PROP_VALUE");
|
|
+ *
|
|
+ */
|
|
+
|
|
+ int acceptCount = pref.getInt(TomcatPlugin.PREF_ACCEPT_COUNT);
|
|
+ if (acceptCount > 0) {
|
|
+ connector.setProperty("backlog",""+acceptCount); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ }
|
|
+
|
|
+ int maxProcessors = pref
|
|
+ .getInt(TomcatPlugin.PREF_MAX_PROCESSORS);
|
|
+ if (maxProcessors > 0) {
|
|
+ connector.setProperty("maxThreads",""+maxProcessors); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ }
|
|
+
|
|
+ int minProcessors = pref
|
|
+ .getInt(TomcatPlugin.PREF_MIN_PROCESSORS);
|
|
+ if (minProcessors > 0) {
|
|
+ connector.setProperty("minSpareThreads",""+minProcessors); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ }
|
|
+
|
|
+ if (this.sslPort > 0) {
|
|
+ connector.setRedirectPort(this.sslPort);
|
|
+ connector.setEnableLookups(true);
|
|
+ connector.setProperty("soTimeout",""+20000); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ //connector.setUseURIValidationHack(false); no longer available
|
|
+ connector.setUseBodyEncodingForURI(false);
|
|
+ String disableUploadTimeout = pref.getString(TomcatPlugin.DISABLE_UPLOAD_TIMEOUT);
|
|
+ if ((disableUploadTimeout != null) && (!("".equals(disableUploadTimeout.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("disableUploadTimeout", disableUploadTimeout); //$NON-NLS-1$
|
|
}
|
|
- // connectorImpl.setDebug(0);
|
|
- // If there is problem in embedded.addConnector()
|
|
- // there is no exception, so add a listener
|
|
- connectorImpl.addLifecycleListener(new LifecycleListener() {
|
|
- public void lifecycleEvent(LifecycleEvent event) {
|
|
- if ("start".equals(event.getType())) //$NON-NLS-1$
|
|
- running = true;
|
|
- }
|
|
- });
|
|
}
|
|
+ // connectorImpl.setDebug(0);
|
|
+ // If there is problem in embedded.addConnector()
|
|
+ // there is no exception, so add a listener
|
|
+ connector.addLifecycleListener(new LifecycleListener() {
|
|
+ public void lifecycleEvent(LifecycleEvent event) {
|
|
+ if (Lifecycle.START_EVENT.equals(event.getType()))
|
|
+ hasConnection = true;
|
|
+ }
|
|
+ });
|
|
|
|
// add Connector to Tomcat
|
|
PrintStream sysErr = System.err;
|
|
@@ -236,21 +254,16 @@
|
|
// its version message there.
|
|
System.setErr(new PrintStream(new ByteArrayOutputStream()));
|
|
try {
|
|
- embedded.addConnector(connector);
|
|
- httpConnector = connector;
|
|
+ this.httpConnector = connector;
|
|
+ embedded.addConnector(this.httpConnector);
|
|
+ httpConnector.start();
|
|
} finally {
|
|
System.setErr(sysErr);
|
|
}
|
|
-
|
|
if (this.sslPort > 0) {
|
|
createSSLConnector(iAddress, this.sslPort);
|
|
}
|
|
|
|
- // if null passed for hostAddress, use local host
|
|
- if (this.hostAddress == null) {
|
|
- this.hostAddress = "127.0.0.1"; //$NON-NLS-1$
|
|
- }
|
|
-
|
|
// running = true;
|
|
TomcatPlugin.getDefault().setAppserver(this);
|
|
|
|
@@ -307,82 +320,115 @@
|
|
* @throws CoreException
|
|
*/
|
|
private void createSSLConnector(InetAddress iAddress, int sslport)
|
|
- throws CoreException {
|
|
+ throws CoreException {
|
|
+
|
|
// Create Connector
|
|
- this.sslConnector = embedded.createConnector(null, sslport, false);
|
|
- // Override defaults on CoyoteConnector
|
|
- if (this.sslConnector instanceof CoyoteConnector) {
|
|
- CoyoteConnector connectorImpl = (CoyoteConnector) this.sslConnector;
|
|
- if (iAddress != null) {
|
|
- // bug in Embedded that incorrectly sets host on connector.
|
|
- // pass null when creating connector, and set host here if
|
|
- // it is specified
|
|
- connectorImpl.setAddress(iAddress.getHostAddress());
|
|
- }
|
|
- Preferences pref = TomcatPlugin.getDefault().getPluginPreferences();
|
|
- int acceptCount = pref.getInt(TomcatPlugin.PREF_ACCEPT_COUNT);
|
|
- if (acceptCount > 0) {
|
|
- connectorImpl.setAcceptCount(acceptCount);
|
|
- }
|
|
- int maxProcessors = pref.getInt(TomcatPlugin.PREF_MAX_PROCESSORS);
|
|
- if (maxProcessors > 0) {
|
|
- connectorImpl.setMaxProcessors(maxProcessors);
|
|
- }
|
|
- int minProcessors = pref.getInt(TomcatPlugin.PREF_MIN_PROCESSORS);
|
|
- if (minProcessors > 0) {
|
|
- connectorImpl.setMinProcessors(minProcessors);
|
|
- }
|
|
- connectorImpl.setUseURIValidationHack(false);
|
|
- connectorImpl.setDisableUploadTimeout(true);
|
|
- connectorImpl.setSecure(true);
|
|
- String scheme = pref.getString(TomcatPlugin.PREF_SSL_SCHEME);
|
|
- if ((scheme != null) && (!("".equals(scheme.trim())))) { //$NON-NLS-1$
|
|
- connectorImpl.setScheme(scheme);
|
|
- }
|
|
- connectorImpl.setEnableLookups(true);
|
|
- CoyoteServerSocketFactory factory = new CoyoteServerSocketFactory();
|
|
- factory.setClientAuth(false);
|
|
- String protocol = pref.getString(TomcatPlugin.PREF_SSL_PROTOCOL);
|
|
- if ((protocol != null) && (!("".equals(protocol.trim())))) { //$NON-NLS-1$
|
|
- factory.setProtocol(protocol);
|
|
- }
|
|
- String algorithm = pref.getString(TomcatPlugin.PREF_SSL_ALGORITHM);
|
|
- if ((algorithm != null) && (!("".equals(algorithm.trim())))) { //$NON-NLS-1$
|
|
- factory.setAlgorithm(algorithm);
|
|
- }
|
|
- String keyStoreFile = pref
|
|
- .getString(TomcatPlugin.PREF_KEY_STORE_FILE);
|
|
- if ((keyStoreFile != null) && (!("".equals(keyStoreFile.trim())))) { //$NON-NLS-1$
|
|
- factory.setKeystoreFile(keyStoreFile);
|
|
- }
|
|
- String keyStorePassword = pref
|
|
- .getString(TomcatPlugin.PREF_KEY_STORE_PASSWORD);
|
|
- if ((keyStorePassword != null)
|
|
- && (!("".equals(keyStorePassword.trim())))) { //$NON-NLS-1$
|
|
- factory.setKeystorePass(keyStorePassword);
|
|
- }
|
|
- connectorImpl.setFactory(factory);
|
|
- connectorImpl.setDebug(0);
|
|
- // If there is problem in embedded.addConnector()
|
|
- // there is no exception, so add a listener
|
|
- connectorImpl.addLifecycleListener(new LifecycleListener() {
|
|
- public void lifecycleEvent(LifecycleEvent event) {
|
|
- if ("start".equals(event.getType())) //$NON-NLS-1$
|
|
- running = true;
|
|
- }
|
|
- });
|
|
- }
|
|
+ //Defaults to local if IAddress is null
|
|
+ Connector connector = embedded.createConnector(iAddress.getHostAddress(), this.port,false);
|
|
|
|
- // add Connector to Tomcat
|
|
- PrintStream sysErr = System.err;
|
|
- // reassign standard error to prevent Coyote from writing
|
|
- // its version message there.
|
|
- System.setErr(new PrintStream(new ByteArrayOutputStream()));
|
|
- try {
|
|
- embedded.addConnector(this.sslConnector);
|
|
- } finally {
|
|
- System.setErr(sysErr);
|
|
+ //--------------------create the Protocol-----------------------//
|
|
+ Preferences pref = TomcatPlugin.getDefault().getPluginPreferences();
|
|
+ /**
|
|
+ * To extend additional properties, make use of org.apache.tomcat.util.IntrospectionUtils
|
|
+ * A Connector will initialize a protocolhandler which initialize a SSLImplementation which initialize
|
|
+ * a ServerSocketFactory
|
|
+ * format : connector.setProperty("STRING_PROP_NAME","STRING_PROP_VALUE");
|
|
+ *
|
|
+ */
|
|
+ //----------------configure connector -------------------------------//
|
|
+ // by looking at the code, it seems like the protocol go in first
|
|
+ String protocol = pref.getString(TomcatPlugin.PREF_SSL_PROTOCOL);
|
|
+ if ((protocol != null) && (!("".equals(protocol.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("protocol",protocol); //$NON-NLS-1$
|
|
+ }
|
|
+ String protocols = pref.getString(TomcatPlugin.PREF_SSL_PROTOCOLS);
|
|
+ if ((protocols != null) && (!("".equals(protocols.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("protocols",protocols); //$NON-NLS-1$
|
|
+ }
|
|
+ String protocolClassName = Http11Protocol.class.getName();
|
|
+ connector.setProtocol(protocolClassName);
|
|
+
|
|
+ String JSSEImplementationName = JSSEImplementation.class.getName();
|
|
+ connector.setProperty("sslImplementation",JSSEImplementationName); //$NON-NLS-1$
|
|
+
|
|
+ String disableUploadTimeout = pref.getString(TomcatPlugin.DISABLE_UPLOAD_TIMEOUT);
|
|
+ if ((disableUploadTimeout != null) && (!("".equals(disableUploadTimeout.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("disableUploadTimeout", disableUploadTimeout); //$NON-NLS-1$
|
|
+ }
|
|
+
|
|
+ String algorithm = pref.getString(TomcatPlugin.PREF_SSL_ALGORITHM);
|
|
+ if ((algorithm != null) && (!("".equals(algorithm.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("algorithm", algorithm); //$NON-NLS-1$
|
|
+ }
|
|
+ int maxProcessors = pref.getInt(TomcatPlugin.PREF_MAX_PROCESSORS);
|
|
+ if (maxProcessors > 0) {
|
|
+ //connector.setMaxProcessors(maxProcessors);
|
|
+ connector.setProperty("maxThreads",""+maxProcessors); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ }
|
|
+ int minProcessors = pref.getInt(TomcatPlugin.PREF_MIN_PROCESSORS);
|
|
+ if (minProcessors > 0) {
|
|
+ //connector.setMinProcessors(minProcessors);
|
|
+ connector.setProperty("minSpareThreads",""+minProcessors); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ }
|
|
+ //this is making use of org.apache.tomcat.util.IntrospectionUtils
|
|
+ connector.setProperty("disableUploadTimeout",""+true); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ String clientauth = pref.getString(TomcatPlugin.PREF_CLIENT_AUTHENTICATION);
|
|
+ if ((clientauth != null) && (!("".equals(clientauth.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("clientauth",clientauth); //$NON-NLS-1$
|
|
+ }
|
|
+
|
|
+ int acceptCount = pref.getInt(TomcatPlugin.PREF_ACCEPT_COUNT);
|
|
+ if (acceptCount > 0) {
|
|
+ connector.setProperty("backlog",""+acceptCount); //$NON-NLS-1$ //$NON-NLS-2$
|
|
+ }
|
|
+
|
|
+ String keyStoreFile = pref
|
|
+ .getString(TomcatPlugin.PREF_KEY_STORE_FILE);
|
|
+ if ((keyStoreFile != null) && (!("".equals(keyStoreFile.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("keystore", keyStoreFile); //$NON-NLS-1$
|
|
+ }
|
|
+ String keyStorePassword = pref
|
|
+ .getString(TomcatPlugin.PREF_KEY_STORE_PASSWORD);
|
|
+ if ((keyStorePassword != null)
|
|
+ && (!("".equals(keyStorePassword.trim())))) { //$NON-NLS-1$
|
|
+ connector.setProperty("keypass", keyStorePassword); //$NON-NLS-1$
|
|
+ }
|
|
+ //connector.setUseURIValidationHack(false); --no longer avaliable, hope they fixed the bug
|
|
+ connector.setUseBodyEncodingForURI(false);
|
|
+ // connector.setSecure(true); ---setting ssLImplementation set secure to true
|
|
+ String scheme = pref.getString(TomcatPlugin.PREF_SSL_SCHEME);
|
|
+ if ((scheme != null) && (!("".equals(scheme.trim())))) { //$NON-NLS-1$
|
|
+ connector.setScheme(scheme);
|
|
+ }
|
|
+ connector.setEnableLookups(true);
|
|
+
|
|
+ //connector.setFactory(factory); --no longer needed, now handled by SSLImplemenatation
|
|
+ // If there is problem in embedded.addConnector()
|
|
+ // there is no exception, so add a listener
|
|
+ connector.addLifecycleListener(new LifecycleListener() {
|
|
+ public void lifecycleEvent(LifecycleEvent event) {
|
|
+ if (Lifecycle.START_EVENT.equals(event.getType())||Lifecycle.PERIODIC_EVENT.equals(event.getType()))
|
|
+ hasSSLConnection = true;
|
|
+ }
|
|
+ });
|
|
+ // add Connector to Tomcat
|
|
+ PrintStream sysErr = (PrintStream) System.err;
|
|
+ // reassign standard error to prevent Coyote from writing
|
|
+ // its version message there.
|
|
+ System.setErr(new PrintStream(new ByteArrayOutputStream()));
|
|
+ try{
|
|
+ sslConnector = connector;
|
|
+ embedded.addConnector(this.sslConnector);
|
|
+ sslConnector.start();
|
|
+ } catch(LifecycleException e){
|
|
+ TomcatPlugin
|
|
+ .logError(
|
|
+ "Exception occurred while establishing secure connection.", //$NON-NLS-1$
|
|
+ e);
|
|
}
|
|
+ finally {
|
|
+ System.setErr(sysErr);
|
|
+ }
|
|
}
|
|
|
|
/**
|
|
@@ -461,17 +507,16 @@
|
|
*/
|
|
public synchronized void start(String webappName, IPath path, ClassLoader customLoader)
|
|
throws CoreException {
|
|
-
|
|
+
|
|
if (!isStarted) {
|
|
start(port, hostAddress);
|
|
- }
|
|
+ }
|
|
if (!running) {
|
|
throw new CoreException(new Status(IStatus.ERROR,
|
|
TomcatPlugin.PLUGIN_ID, IStatus.OK, NLS.bind(
|
|
TomcatResources.TomcatAppServer_addingWebapp,
|
|
webappName, path.toOSString()), null));
|
|
}
|
|
-
|
|
String contextPath = webappName;
|
|
if (!contextPath.startsWith("/")) { //$NON-NLS-1$
|
|
contextPath = "/" + contextPath; //$NON-NLS-1$
|
|
@@ -486,7 +531,6 @@
|
|
|
|
WebAppClassLoader webappLoader = new WebAppClassLoader(customLoader);
|
|
context.setLoader(embedded.createLoader(webappLoader));
|
|
-
|
|
host.addChild(context);
|
|
contexts.add(context);
|
|
} catch (Exception exc) {
|
|
@@ -601,4 +645,4 @@
|
|
return TomcatPlugin.getDefault().getStateLocation().append(webApp)
|
|
.toOSString();
|
|
}
|
|
-}
|
|
+}
|
|
\ No newline at end of file
|
|
Index: META-INF/MANIFEST.MF
|
|
===================================================================
|
|
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/META-INF/MANIFEST.MF,v
|
|
retrieving revision 1.25
|
|
diff -u -r1.25 MANIFEST.MF
|
|
--- META-INF/MANIFEST.MF 31 May 2007 18:15:24 -0000 1.25
|
|
+++ META-INF/MANIFEST.MF 16 Nov 2007 16:03:10 -0000
|
|
@@ -1,7 +1,7 @@
|
|
Manifest-Version: 1.0
|
|
Bundle-ManifestVersion: 2
|
|
Bundle-Name: %pluginName
|
|
-Bundle-SymbolicName: org.eclipse.tomcat; singleton:=true
|
|
+Bundle-SymbolicName: org.eclipse.tomcat;singleton:=true
|
|
Bundle-Version: 4.1.230.qualifier
|
|
Bundle-ClassPath: tomcatwrapper.jar,
|
|
catalina.jar,
|
|
@@ -11,21 +11,28 @@
|
|
commons-digester.jar,
|
|
commons-logging-api.jar,
|
|
commons-modeler.jar,
|
|
- jakarta-regexp-1.3.jar,
|
|
- jasper-compiler.jar,
|
|
- jasper-runtime.jar,
|
|
mx4j-jmx.jar,
|
|
- naming-common.jar,
|
|
naming-factory.jar,
|
|
naming-resources.jar,
|
|
- servlet.jar,
|
|
- servlets-common.jar,
|
|
servlets-default.jar,
|
|
servlets-invoker.jar,
|
|
- servlets-manager.jar,
|
|
tomcat-coyote.jar,
|
|
- tomcat-http11.jar,
|
|
- tomcat-util.jar
|
|
+ tomcat-util.jar,
|
|
+ catalina-optional.jar,
|
|
+ commons-dbcp.jar,
|
|
+ commons-digester-rss.jar,
|
|
+ commons-el.jar,
|
|
+ commons-fileupload.jar,
|
|
+ commons-launcher.jar,
|
|
+ commons-pool.jar,
|
|
+ jasper5-compiler.jar,
|
|
+ jasper5-runtime.jar,
|
|
+ jspapi.jar,
|
|
+ mx4j.jar,
|
|
+ mx4j-impl.jar,
|
|
+ regexp.jar,
|
|
+ servletapi5.jar,
|
|
+ tomcat-http.jar
|
|
Bundle-Activator: org.eclipse.tomcat.internal.TomcatPlugin
|
|
Bundle-Vendor: %providerName
|
|
Bundle-Localization: plugin
|