Package: eclipse / 3.8.1-10

jetty-compatibility.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
Description: Fixes the compatibility with the latest version of Jetty
Origin: backport, http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/diff/bundles/org.eclipse.equinox.http.jetty9/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java?id=d27519ac25b8a902dbacb9c888ff1aaf5a220ea1
--- a/dependencies/dependencies.properties
+++ b/dependencies/dependencies.properties
@@ -23,12 +23,12 @@
 org.apache.lucene.core_2.9.1.v201101211721.jar=/usr/share/java/lucene.jar:/usr/share/java/lucene-core.jar
 org.apache.lucene.analysis_2.9.1.v201101211721.jar=/usr/share/java/lucene-contrib/lucene-analyzers.jar:/usr/share/java/lucene-analyzers.jar
 org.eclipse.swt_3.7.1.jar=/usr/share/java/swt.jar
-org.eclipse.jetty.util_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-util.jar
-org.eclipse.jetty.server_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-server.jar
-org.eclipse.jetty.http_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-http.jar
-org.eclipse.jetty.continuation_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-continuation.jar
-org.eclipse.jetty.io_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-io.jar
-org.eclipse.jetty.security_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-security.jar
-org.eclipse.jetty.servlet_8.1.0.v20120127.jar=/usr/share/java/jetty/jetty-servlet.jar
+org.eclipse.jetty.util_8.1.0.v20120127.jar=/usr/share/java/jetty9-util.jar
+org.eclipse.jetty.server_8.1.0.v20120127.jar=/usr/share/java/jetty9-server.jar
+org.eclipse.jetty.http_8.1.0.v20120127.jar=/usr/share/java/jetty9-http.jar
+org.eclipse.jetty.continuation_8.1.0.v20120127.jar=/usr/share/java/jetty9-continuation.jar
+org.eclipse.jetty.io_8.1.0.v20120127.jar=/usr/share/java/jetty9-io.jar
+org.eclipse.jetty.security_8.1.0.v20120127.jar=/usr/share/java/jetty9-security.jar
+org.eclipse.jetty.servlet_8.1.0.v20120127.jar=/usr/share/java/jetty9-servlet.jar
 org.sat4j.core_2.3.0.v20110329.jar=/usr/share/java/org.sat4j.core.jar:/usr/share/sat4j/org.sat4j.core.jar
 org.sat4j.pb_2.3.0.v20110329.jar=/usr/share/java/org.sat4j.pb.jar:/usr/share/sat4j/org.sat4j.pb.jar
--- a/eclipse/plugins/org.eclipse.equinox.http.jetty_3.0.0/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/org.eclipse.equinox.http.jetty_3.0.0/META-INF/MANIFEST.MF
@@ -9,19 +9,15 @@
 Import-Package: javax.servlet;version="[2.6.0,4.0.0)",
  javax.servlet.http;version="[2.6.0,4.0.0)",
  org.eclipse.equinox.http.servlet;version="1.0.0",
- org.eclipse.jetty.http;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.io.bio;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.io.nio;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.server;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.server.bio;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.server.handler;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.server.nio;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.server.session;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.server.ssl;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.servlet;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.util;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.util.component;version="[8.0.0,9.0.0)",
- org.eclipse.jetty.util.log;version="[8.0.0,9.0.0)",
+ org.eclipse.jetty.http;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.server;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.server.handler;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.server.nio;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.server.session;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.servlet;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.util;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.util.component;version="[8.0.0,10.0.0)",
+ org.eclipse.jetty.util.log;version="[8.0.0,10.0.0)",
  org.osgi.framework;version="1.3.0",
  org.osgi.service.cm;version="1.2.0",
  org.osgi.service.startlevel;version="1.0"
--- a/eclipse/plugins/org.eclipse.equinox.http.jetty_3.0.0/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
+++ b/eclipse/plugins/org.eclipse.equinox.http.jetty_3.0.0/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
@@ -19,14 +19,17 @@
 import org.eclipse.equinox.http.jetty.JettyCustomizer;
 import org.eclipse.equinox.http.servlet.HttpServiceServlet;
 import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
 import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.bio.SocketConnector;
-import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SslConnectionFactory;
 import org.eclipse.jetty.server.session.HashSessionManager;
 import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.server.ssl.SslSocketConnector;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.osgi.framework.Constants;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedServiceFactory;
@@ -69,16 +72,18 @@
 
 		JettyCustomizer customizer = createJettyCustomizer(dictionary);
 
-		Connector httpConnector = createHttpConnector(dictionary);
+		HttpConfiguration http_config = new HttpConfiguration();
+
+		ServerConnector httpConnector = createHttpConnector(dictionary, server, http_config);
 		if (null != customizer)
-			httpConnector = (Connector) customizer.customizeHttpConnector(httpConnector, dictionary);
+			httpConnector = (ServerConnector) customizer.customizeHttpConnector(httpConnector, dictionary);
 
 		if (httpConnector != null)
 			server.addConnector(httpConnector);
 
-		Connector httpsConnector = createHttpsConnector(dictionary);
+		ServerConnector httpsConnector = createHttpsConnector(dictionary, server, http_config);
 		if (null != customizer)
-			httpsConnector = (Connector) customizer.customizeHttpsConnector(httpsConnector, dictionary);
+			httpsConnector = (ServerConnector) customizer.customizeHttpsConnector(httpsConnector, dictionary);
 		if (httpsConnector != null)
 			server.addConnector(httpsConnector);
 
@@ -125,7 +130,7 @@
 		servers.clear();
 	}
 
-	private Connector createHttpConnector(@SuppressWarnings("rawtypes") Dictionary dictionary) {
+	private ServerConnector createHttpConnector(@SuppressWarnings("rawtypes") Dictionary dictionary, Server server, HttpConfiguration http_config) {
 		Boolean httpEnabled = null;
 		Object httpEnabledObj = dictionary.get(JettyConstants.HTTP_ENABLED);
 		if (httpEnabledObj instanceof Boolean)
@@ -141,40 +146,16 @@
 			return null;
 
 		
-		Integer httpPort = null;
-		Object httpPortObj = dictionary.get(JettyConstants.HTTP_PORT);
-		if (httpPortObj instanceof Integer)
-		{
-			httpPort = (Integer) httpPortObj;
-		}
-		else
-			if (httpPortObj instanceof String)
-			{
-				httpPort = Integer.valueOf(httpPortObj.toString());
-			}
+		Integer httpPort = getIntProperty(dictionary, JettyConstants.HTTP_PORT);
 		if (httpPort == null)
 			return null;
 
-		Boolean nioEnabled = null;
-		Object nioEnabledObj = dictionary.get(JettyConstants.HTTP_NIO);
-		if (nioEnabledObj instanceof Boolean)
-		{
-			nioEnabled = (Boolean) nioEnabledObj;			
+		if (isHttpsEnabled(dictionary)) {
+			http_config.setSecureScheme("https");
+			http_config.setSecurePort(getIntProperty(dictionary, JettyConstants.HTTPS_PORT));
 		}
-		else
-			if (nioEnabledObj instanceof String)
-			{
-				nioEnabled = Boolean.parseBoolean(nioEnabledObj.toString());
-			}	
-		if (nioEnabled == null)
-			nioEnabled = getDefaultNIOEnablement();
-
-		Connector connector;
-		if (nioEnabled.booleanValue())
-			connector = new SelectChannelConnector();
-		else
-			connector = new SocketConnector();
 
+		ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));
 		connector.setPort(httpPort.intValue());
 
 		String httpHost = (String) dictionary.get(JettyConstants.HTTP_HOST);
@@ -193,81 +174,36 @@
 		return connector;
 	}
 
-	private Boolean getDefaultNIOEnablement() {
-		Properties systemProperties = System.getProperties();
-		String javaVendor = systemProperties.getProperty("java.vendor", ""); //$NON-NLS-1$ //$NON-NLS-2$
-		if (javaVendor.equals("IBM Corporation")) { //$NON-NLS-1$
-			String javaVersion = systemProperties.getProperty("java.version", ""); //$NON-NLS-1$ //$NON-NLS-2$
-			if (javaVersion.startsWith("1.4")) //$NON-NLS-1$
-				return Boolean.FALSE;
-			// Note: no problems currently logged with 1.5
-			if (javaVersion.equals("1.6.0")) { //$NON-NLS-1$
-				String jclVersion = systemProperties.getProperty("java.jcl.version", ""); //$NON-NLS-1$ //$NON-NLS-2$
-				if (jclVersion.startsWith("2007")) //$NON-NLS-1$
-					return Boolean.FALSE;
-				if (jclVersion.startsWith("2008") && !jclVersion.startsWith("200811") && !jclVersion.startsWith("200812")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-					return Boolean.FALSE;
-			}
-		}
-		return Boolean.TRUE;
-	}
-
 	@SuppressWarnings("deprecation")
-	private Connector createHttpsConnector(@SuppressWarnings("rawtypes") Dictionary dictionary) {
-		Boolean httpsEnabled = null;
-		Object httpsEnabledObj = dictionary.get(JettyConstants.HTTPS_ENABLED);
-		if (httpsEnabledObj instanceof Boolean)
-		{
-			httpsEnabled = (Boolean) httpsEnabledObj;			
-		}
-		else
-			if (httpsEnabledObj instanceof String)
-			{
-				httpsEnabled = Boolean.parseBoolean(httpsEnabledObj.toString());
-			}	
-		if (httpsEnabled == null || !httpsEnabled.booleanValue())
+	private ServerConnector createHttpsConnector(@SuppressWarnings("rawtypes") Dictionary dictionary, Server server, HttpConfiguration http_config) {
+		boolean httpsEnabled = isHttpsEnabled(dictionary);
+		if (!httpsEnabled)
 			return null;
 
-		Integer httpsPort = null;
-		Object httpsPortObj = dictionary.get(JettyConstants.HTTPS_PORT);
-		if (httpsPortObj instanceof Integer)
-		{
-			httpsPort = (Integer) httpsPortObj;
-		}
-		else
-			if (httpsPortObj instanceof String)
-			{
-				httpsPort = Integer.valueOf(httpsPortObj.toString());
-			}
+		Integer httpsPort = getIntProperty(dictionary, JettyConstants.HTTPS_PORT);
 		if (httpsPort == null)
 			return null;
 
-		SslSocketConnector sslConnector = new SslSocketConnector();
-		sslConnector.setPort(httpsPort.intValue());
-
-		String httpsHost = (String) dictionary.get(JettyConstants.HTTPS_HOST);
-		if (httpsHost != null) {
-			sslConnector.setHost(httpsHost);
-		}
+		SslContextFactory sslContextFactory = new SslContextFactory();
 
 		String keyStore = (String) dictionary.get(JettyConstants.SSL_KEYSTORE);
 		if (keyStore != null)
-			sslConnector.setKeystore(keyStore);
+			sslContextFactory.setKeyStorePath(keyStore);
 
 		String password = (String) dictionary.get(JettyConstants.SSL_PASSWORD);
 		if (password != null)
-			sslConnector.setPassword(password);
+			sslContextFactory.setKeyStorePassword(password);
 
 		String keyPassword = (String) dictionary.get(JettyConstants.SSL_KEYPASSWORD);
 		if (keyPassword != null)
-			sslConnector.setKeyPassword(keyPassword);
+			sslContextFactory.setKeyManagerPassword(keyPassword);
 
 		Object needClientAuth = dictionary.get(JettyConstants.SSL_NEEDCLIENTAUTH);
 		if (needClientAuth != null) {
 			if (needClientAuth instanceof String)
 				needClientAuth = Boolean.valueOf((String) needClientAuth);
 
-			sslConnector.setNeedClientAuth(((Boolean) needClientAuth).booleanValue());
+			sslContextFactory.setNeedClientAuth(((Boolean) needClientAuth).booleanValue());
 		}
 
 		Object wantClientAuth = dictionary.get(JettyConstants.SSL_WANTCLIENTAUTH);
@@ -275,16 +211,27 @@
 			if (wantClientAuth instanceof String)
 				wantClientAuth = Boolean.valueOf((String) wantClientAuth);
 
-			sslConnector.setWantClientAuth(((Boolean) wantClientAuth).booleanValue());
+			sslContextFactory.setWantClientAuth(((Boolean) wantClientAuth).booleanValue());
 		}
 
 		String protocol = (String) dictionary.get(JettyConstants.SSL_PROTOCOL);
 		if (protocol != null)
-			sslConnector.setProtocol(protocol);
+			sslContextFactory.setProtocol(protocol);
 
 		String keystoreType = (String) dictionary.get(JettyConstants.SSL_KEYSTORETYPE);
 		if (keystoreType != null)
-			sslConnector.setKeystoreType(keystoreType);
+			sslContextFactory.setKeyStoreType(keystoreType);
+
+		HttpConfiguration https_config = new HttpConfiguration(http_config);
+		https_config.addCustomizer(new SecureRequestCustomizer());
+
+		ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config));
+		sslConnector.setPort(httpsPort.intValue());
+
+		String httpsHost = (String) dictionary.get(JettyConstants.HTTPS_HOST);
+		if (httpsHost != null) {
+			sslConnector.setHost(httpsHost);
+		}
 
 		if (sslConnector.getPort() == 0) {
 			try {
@@ -297,6 +244,31 @@
 		return sslConnector;
 	}
 
+	private Integer getIntProperty(@SuppressWarnings("rawtypes") Dictionary dictionary, String property) {
+		Integer httpPort = null;
+		Object httpPortObj = dictionary.get(property);
+		if (httpPortObj instanceof Integer) {
+			httpPort = (Integer) httpPortObj;
+		} else if (httpPortObj instanceof String) {
+			httpPort = Integer.valueOf(httpPortObj.toString());
+		}
+		if (httpPort == null) {
+			throw new IllegalArgumentException("Expected " + property + "property, but it is not set."); //$NON-NLS-1$//$NON-NLS-2$
+		}
+		return httpPort;
+	}
+
+	private boolean isHttpsEnabled(@SuppressWarnings("rawtypes") Dictionary dictionary) {
+		Boolean httpsEnabled = false;
+		Object httpsEnabledObj = dictionary.get(JettyConstants.HTTPS_ENABLED);
+		if (httpsEnabledObj instanceof Boolean) {
+			httpsEnabled = (Boolean) httpsEnabledObj;
+		} else if (httpsEnabledObj instanceof String) {
+			httpsEnabled = Boolean.parseBoolean(httpsEnabledObj.toString());
+		}
+		return httpsEnabled;
+	}
+
 	private ServletContextHandler createHttpContext(@SuppressWarnings("rawtypes") Dictionary dictionary) {
 		ServletContextHandler httpContext = new ServletContextHandler();
 		httpContext.setAttribute(INTERNAL_CONTEXT_CLASSLOADER, Thread.currentThread().getContextClassLoader());
--- a/eclipse/plugins/org.eclipse.equinox.http.jetty_3.0.0/src/org/eclipse/equinox/http/jetty/internal/EquinoxStdErrLog.java
+++ b/eclipse/plugins/org.eclipse.equinox.http.jetty_3.0.0/src/org/eclipse/equinox/http/jetty/internal/EquinoxStdErrLog.java
@@ -97,6 +97,13 @@
 		realLogger.debug(msg, th);
 	}
 
+	public void debug(String msg, long value) {
+		if (threshold > DEBUG)
+			return;
+
+		realLogger.debug(msg, value);
+	}
+
 	// infoSOO = slf4j.getMethod("info", new Class[]{String.class,Object.class,Object.class});
 	public void info(String msg, Object... arg0) {
 		if (threshold > INFO)