eclipse/eclipse-tomcat55.patch
2006-02-28 23:05:11 +00:00

902 lines
40 KiB
Diff

Index: .classpath
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/.classpath,v
retrieving revision 1.20
diff -u -r1.20 .classpath
--- .classpath 21 Apr 2005 23:31:58 -0000 1.20
+++ .classpath 28 Feb 2006 22:56:26 -0000
@@ -1,29 +1,36 @@
<?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 kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="catalina.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="bootstrap.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="commons-beanutils.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="commons-collections.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="commons-digester.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="commons-modeler.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="jakarta-regexp-1.3.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="jasper-compiler.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="jasper-runtime.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="mx4j-jmx.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="naming-factory.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="naming-resources.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="servlets-default.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="servlets-invoker.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="tomcat-coyote.jar"/>
+ <classpathentry kind="lib" exported="true" sourcepath="D:/tomcat4.1.30src" path="tomcat-util.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <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-logging.jar"/>
+ <classpathentry kind="lib" path="commons-pool.jar"/>
+ <classpathentry kind="lib" path="mx4j-impl.jar"/>
+ <classpathentry kind="lib" path="mx4j.jar"/>
+ <classpathentry kind="lib" path="jspapi.jar"/>
+ <classpathentry kind="lib" path="catalina-optional.jar"/>
+ <classpathentry kind="lib" path="tomcat-http.jar"/>
+ <classpathentry kind="lib" path="servletapi5.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Index: about.html
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/about.html,v
retrieving revision 1.24
diff -u -r1.24 about.html
--- about.html 21 Jun 2005 00:52:06 -0000 1.24
+++ about.html 28 Feb 2006 22:56:26 -0000
@@ -8,7 +8,7 @@
<body lang="EN-US">
<h2>About This Content</h2>
-<p>February 24, 2005</p>
+<p>February 24, 2005 (modified June 14, 2005 with update to Tomcat 5.0.30)</p>
<h3>License</h3>
<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
@@ -23,7 +23,7 @@
<p>The Content includes items that have been sourced from third parties as follows:</p>
-<p><b>Tomcat 4.1.30</b></p>
+<p><b>Tomcat 5.0.30</b></p>
<p>The plug-in is based on software developed by The Apache Software Foundation as part of the Jakarta project. Therefore:</p>
<blockquote>
@@ -35,24 +35,31 @@
<ul type="disc">
<li>bootstrap.jar</li>
<li>catalina.jar</li>
- <li>commons-beanutils.jar</li>
- <li>commons-collections.jar</li>
- <li>commons-digester.jar</li>
- <li>commons-logging.jar</li>
- <li>commons-logging-api.jar</li>
- <li>commons-modeler.jar</li>
- <li>jakarta-regexp-1.3.jar</li>
- <li>jasper-compiler.jar</li>
- <li>jasper-runtime.jar</li>
+ <li>catalina-optional.jar</li>
+ <li>jakarta-commons-beanutils.jar</li>
+ <li>jakarta-commons-collections.jar</li>
+ <li>jakarta-commons-dbcp.jar</li>
+ <li>jakarta-commons-digester.jar</li>
+ <li>jakarta-commons-digester-rss.jar</li>
+ <li>jakarta-commons-el.jar</li>
+ <li>jakarta-commons-fileupload.jar</li>
+ <li>jakarta-commons-launcher.jar</li>
+ <li>jakarta-commons-logging.jar</li>
+ <li>jakarta-commons-modeler.jar</li>
+ <li>jakarta-commons-pool.jar</li>
+ <li>jasper5-compiler.jar</li>
+ <li>jasper5-runtime.jar</li>
+ <li>mx4j.jar</li>
+ <li>mx4j-impl.jar</li>
<li>mx4j-jmx.jar</li>
<li>naming-common.jar</li>
<li>naming-factory.jar</li>
<li>naming-resources.jar</li>
- <li>servlet.jar</li>
+ <li>regexp.jar</li>
+ <li>servletapi5.jar</li>
<li>servlets-common.jar</li>
<li>servlets-default.jar</li>
<li>servlets-invoker.jar</li>
- <li>servlets-manager.jar</li>
<li>tomcat-coyote.jar</li>
<li>tomcat-http11.jar</li>
<li>tomcat-util.jar</li>
@@ -66,10 +73,10 @@
<p>Tomcat is:</p>
-<blockquote>Copyright (c) 1999, 2000 The Apache Software Foundation. All rights reserved.</blockquote>
+<blockquote>Copyright (c) 1999-2003 The Apache Software Foundation. All rights reserved.</blockquote>
-<p>Your use of the Tomcat code is subject to the terms and conditions of the Apache Software License 1.1 which is available at
-<a href="http://www.apache.org/licenses/LICENSE-1.1">http://www.apache.org/licenses/LICENSE-1.1</a>. More specifically:</p>
+<p>Your use of the Tomcat code is subject to the terms and conditions of the Apache Software License 2.0 which is available at
+<a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>. More specifically:</p>
<blockquote>
1. Redistributions of source code must retain the above copyright notice, this list of<br>
conditions and the following disclaimer.<br>
@@ -107,11 +114,11 @@
<p>Source code for Tomcat is available at <a href="http://jakarta.apache.org/tomcat/">http://jakarta.apache.org/tomcat/</a>.</p>
-<strong>MX4J 1.1.1</strong>
+<strong>MX4J 2.1.0</strong>
-<p></p>Tomcat 4.1.30 includes mx4j-jmx.jar from MX4J 1.1.1. MX4J is:</p>
+<p></p>Tomcat 5.0.30 includes mx4j.jar, mx4j-jmx.jar and mx4j-impl.jar from MX4J 2.1.0. MX4J is:</p>
-<blockquote>Copyright (c) 2001 MX4J. All rights reserved.</blockquote>
+<blockquote>Copyright (c) 2001-2004 MX4J contributors. All rights reserved.</blockquote>
<p>Your use of the MX4J code is subject to the terms and conditions of the MX4J License, Version 1.0, a copy of which is included
with the Content in the file <a href="mx4j.license">mx4j.license</a>. More specifically: </p>
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.tomcat/META-INF/MANIFEST.MF,v
retrieving revision 1.14
diff -u -r1.14 MANIFEST.MF
--- META-INF/MANIFEST.MF 19 May 2005 04:05:11 -0000 1.14
+++ META-INF/MANIFEST.MF 28 Feb 2006 22:56:42 -0000
@@ -2,29 +2,34 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.tomcat; singleton:=true
-Bundle-Version: 4.1.30.1
-Bundle-ClassPath: tomcatwrapper.jar,
+Bundle-Version: 5.5.15
+Bundle-ClassPath: bootstrap.jar,
+ catalina-optional.jar,
catalina.jar,
- bootstrap.jar,
commons-beanutils.jar,
commons-collections.jar,
+ commons-dbcp.jar,
+ commons-digester-rss.jar,
commons-digester.jar,
- commons-logging-api.jar,
+ commons-el.jar,
+ commons-fileupload.jar,
+ commons-launcher.jar,
+ commons-logging.jar,
commons-modeler.jar,
+ commons-pool.jar,
jakarta-regexp-1.3.jar,
jasper-compiler.jar,
jasper-runtime.jar,
+ jspapi.jar,
+ mx4j-impl.jar,
mx4j-jmx.jar,
- naming-common.jar,
+ mx4j.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-http.jar,
tomcat-util.jar
Bundle-Activator: org.eclipse.tomcat.internal.TomcatPlugin
Bundle-Vendor: %providerName
@@ -54,8 +59,6 @@
mx4j.util;x-internal:=true,
org.apache.catalina;x-internal:=true,
org.apache.catalina.connector;x-internal:=true,
- org.apache.catalina.connector.http;x-internal:=true,
- org.apache.catalina.connector.http10;x-internal:=true,
org.apache.catalina.realm;x-internal:=true,
org.apache.catalina.servlets;x-internal:=true,
org.apache.commons.beanutils;x-internal:=true,
@@ -82,10 +85,9 @@
org.apache.coyote.tomcat4;x-internal:=true,
org.apache.jasper;x-internal:=true,
org.apache.jasper.compiler;x-internal:=true,
- org.apache.jasper.logging;x-internal:=true,
org.apache.jasper.runtime;x-internal:=true,
org.apache.jasper.servlet;x-internal:=true,
- org.apache.jasper.util;x-internal:=true,
+ org.apache.jasper.util,
org.apache.jasper.xmlparser;x-internal:=true,
org.apache.naming;x-internal:=true,
org.apache.naming.factory;x-internal:=true,
@@ -96,11 +98,9 @@
org.apache.tomcat.util.buf;x-internal:=true,
org.apache.tomcat.util.collections;x-internal:=true,
org.apache.tomcat.util.compat;x-internal:=true,
- org.apache.tomcat.util.handler;x-internal:=true,
org.apache.tomcat.util.http;x-internal:=true,
org.apache.tomcat.util.http.mapper;x-internal:=true,
org.apache.tomcat.util.log;x-internal:=true,
- org.apache.tomcat.util.mx;x-internal:=true,
org.apache.tomcat.util.net;x-internal:=true,
org.apache.tomcat.util.net.jsse;x-internal:=true,
org.apache.tomcat.util.res;x-internal:=true,
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.8
diff -u -r1.8 EclipseErrorReportValve.java
--- src/org/eclipse/tomcat/internal/EclipseErrorReportValve.java 23 May 2005 03:58:04 -0000 1.8
+++ src/org/eclipse/tomcat/internal/EclipseErrorReportValve.java 28 Feb 2006 22:56:42 -0000
@@ -69,15 +69,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.ServletRequest;
+import javax.servlet.ServletResponse;
+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,18 +157,18 @@
* @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;
+ ServletRequest sreq = request;
Throwable throwable =
(Throwable) sreq.getAttribute(Globals.EXCEPTION_ATTR);
- ServletResponse sresp = (ServletResponse) response;
+ ServletResponse sresp = response;
if (sresp.isCommitted()) {
return;
}
@@ -173,7 +185,7 @@
;
}
- ServletResponse sresponse = (ServletResponse) response;
+ ServletResponse sresponse = response;
if (sresponse instanceof HttpServletResponse)
((HttpServletResponse) sresponse).sendError
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -219,15 +231,9 @@
Throwable throwable)
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());
+ HttpServletResponse hres = response;
+ int statusCode = response.getStatus();
+ String message = RequestUtil.filter(response.getMessage());
if (message == null)
message = "";
@@ -373,9 +379,9 @@
*/
protected void log(String message) {
- Logger logger = container.getLogger();
+ Logger logger = (Logger) container.getLogger();
if (logger != null)
- logger.log(this.toString() + ": " + message);
+ logger.info(this.toString() + ": " + message);
else
System.out.println(this.toString() + ": " + message);
@@ -390,9 +396,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);
+ logger.info(this.toString() + ": " + message, throwable);
else {
System.out.println(this.toString() + ": " + message);
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.43
diff -u -r1.43 TomcatAppServer.java
--- src/org/eclipse/tomcat/internal/TomcatAppServer.java 22 Jun 2005 15:29:56 -0000 1.43
+++ src/org/eclipse/tomcat/internal/TomcatAppServer.java 28 Feb 2006 22:56:42 -0000
@@ -17,21 +17,21 @@
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.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
@@ -91,27 +91,39 @@
* 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";
+ } 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;
+ 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);
- URL installURL = TomcatPlugin.getDefault().getBundle()
- .getEntry("/"); //$NON-NLS-1$
- 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$
+ embedded = new Embedded(new MemoryRealm());
+ URL installURL = TomcatPlugin.getDefault().getBundle()
+ .getEntry("/"); //$NON-NLS-1$
+ 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$
// Set up realm if one found
if (TomcatPlugin.getDefault().getPluginPreferences().getInt(
@@ -119,14 +131,22 @@
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$ //$NON-NLS-2$
// all request go to our only host
engine.setDefaultHost(host.getName());
@@ -136,7 +156,7 @@
.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
@@ -146,8 +166,8 @@
embedded.addEngine(engine);
} finally {
System.setOut(sysOut);
- }
-
+ }
+
// Root context
Context root = embedded.createContext("", home + "/webapps/ROOT"); //$NON-NLS-1$ //$NON-NLS-2$
// this line should be replaced once tomcat provides support
@@ -156,103 +176,97 @@
((StandardContext) root)
.setWorkDir(getWorkingDirectory("ROOT")); //$NON-NLS-1$
}
+
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
- }
- }
+ host.addChild(root);
+ contexts.add(root);
+
updateSslPort(iAddress);
if (this.port == 0) {
- this.port = SocketUtil.findUnusedLocalPort(iAddress); //$NON-NLS-1$
+ this.port = SocketUtil.findUnusedLocalPort(iAddress);
if (this.port == -1) {
throw new CoreException(
new Status(
IStatus.ERROR,
TomcatPlugin.PLUGIN_ID,
IStatus.OK,
- TomcatResources.TomcatAppServer_start_CannotObtainPort, //$NON-NLS-1$
+ TomcatResources.TomcatAppServer_start_CannotObtainPort,
null));
}
}
// 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);
- }
- // 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;
- }
- });
+ 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);
}
+ int maxProcessors = pref
+ .getInt(TomcatPlugin.PREF_MAX_PROCESSORS);
+ if (maxProcessors > 0) {
+ connector.setProperty("maxThreads",""+maxProcessors);
+ }
+
+ int minProcessors = pref
+ .getInt(TomcatPlugin.PREF_MIN_PROCESSORS);
+ if (minProcessors > 0) {
+ connector.setProperty("minSpareThreads",""+minProcessors);
+ }
+
+ if (this.sslPort > 0) {
+ connector.setRedirectPort(this.sslPort);
+ connector.setEnableLookups(true);
+ connector.setProperty("soTimeout",""+20000);
+ // 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);
+ }
+ }
+
+ // 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;
// reassign standard error to prevent Coyote from writing
// 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);
-
+
} catch (Exception exc) {
TomcatPlugin
.logError(
@@ -306,91 +320,129 @@
* @throws CoreException
*/
private void createSSLConnector(InetAddress iAddress, int sslport)
- 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;
- }
- });
- }
-
- // 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);
- }
- }
-
- /**
- * Creates a {@link Realm}object using the information contained in
- * extensions of the type org.eclipse.tomcat.realmfactory in the plugin
- * registry.
- *
- * @return the {@link Realm}object created
- */
+ throws CoreException {
+ // Create Connector
+ // Defaults to local if iAddress is null
+ Connector connector = embedded.createConnector(iAddress
+ .getHostAddress(), this.port, false);
+
+ // --------------------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);
+ }
+ String protocols = pref.getString(TomcatPlugin.PREF_SSL_PROTOCOLS);
+ if ((protocols != null) && (!("".equals(protocols.trim())))) { //$NON-NLS-1$
+ connector.setProperty("protocols", protocols);
+ }
+ String protocolClassName = Http11Protocol.class.getName();
+ connector.setProtocol(protocolClassName);
+
+ String JSSEImplementationName = JSSEImplementation.class.getName();
+ connector.setProperty("sslImplementation", JSSEImplementationName);
+
+ String disableUploadTimeout = pref
+ .getString(TomcatPlugin.DISABLE_UPLOAD_TIMEOUT);
+ if ((disableUploadTimeout != null)
+ && (!("".equals(disableUploadTimeout.trim())))) { //$NON-NLS-1$
+ connector.setProperty("disableUploadTimeout", disableUploadTimeout);
+ }
+
+ String algorithm = pref.getString(TomcatPlugin.PREF_SSL_ALGORITHM);
+ if ((algorithm != null) && (!("".equals(algorithm.trim())))) { //$NON-NLS-1$
+ connector.setProperty("algorithm", algorithm);
+ }
+ int maxProcessors = pref.getInt(TomcatPlugin.PREF_MAX_PROCESSORS);
+ if (maxProcessors > 0) {
+ // connector.setMaxProcessors(maxProcessors);
+ connector.setProperty("maxThreads", "" + maxProcessors);
+ }
+ int minProcessors = pref.getInt(TomcatPlugin.PREF_MIN_PROCESSORS);
+ if (minProcessors > 0) {
+ // connector.setMinProcessors(minProcessors);
+ connector.setProperty("minSpareThreads", "" + minProcessors);
+ }
+ // this is making use of org.apache.tomcat.util.IntrospectionUtils
+ connector.setProperty("disableUploadTimeout", "" + true);
+ String clientauth = pref
+ .getString(TomcatPlugin.PREF_CLIENT_AUTHENTICATION);
+ if ((clientauth != null) && (!("".equals(clientauth.trim())))) { //$NON-NLS-1$
+ connector.setProperty("clientauth", clientauth);
+ }
+
+ int acceptCount = pref.getInt(TomcatPlugin.PREF_ACCEPT_COUNT);
+ if (acceptCount > 0) {
+ connector.setProperty("backlog", "" + acceptCount);
+ }
+
+ String keyStoreFile = pref.getString(TomcatPlugin.PREF_KEY_STORE_FILE);
+ if ((keyStoreFile != null) && (!("".equals(keyStoreFile.trim())))) { //$NON-NLS-1$
+ connector.setProperty("keystore", keyStoreFile);
+ }
+ String keyStorePassword = pref
+ .getString(TomcatPlugin.PREF_KEY_STORE_PASSWORD);
+ if ((keyStorePassword != null)
+ && (!("".equals(keyStorePassword.trim())))) { //$NON-NLS-1$
+ connector.setProperty("keypass", keyStorePassword);
+ }
+ // 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 = 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);
+ }
+ }
+
+ /**
+ * Creates a {@link Realm}object using the information contained in
+ * extensions of the type org.eclipse.tomcat.realmfactory in the plugin
+ * registry.
+ *
+ * @return the {@link Realm}object created
+ */
private Realm getRealm() {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(
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 28 Feb 2006 22:56:42 -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;