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)
