From dev-return-57112-archive-asf-public=cust-asf.ponee.io@directory.apache.org Fri Jan 26 12:58:50 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id C3243180657 for ; Fri, 26 Jan 2018 12:58:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B334E160C20; Fri, 26 Jan 2018 11:58:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D5566160C3E for ; Fri, 26 Jan 2018 12:58:49 +0100 (CET) Received: (qmail 17481 invoked by uid 500); 26 Jan 2018 11:58:49 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 17466 invoked by uid 99); 26 Jan 2018 11:58:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jan 2018 11:58:48 +0000 From: GitBox To: dev@directory.apache.org Subject: [GitHub] ebourg closed pull request #1: Jetty 9 upgrade Message-ID: <151696792842.16412.1701886413255792192.gitbox@gitbox.apache.org> ebourg closed pull request #1: Jetty 9 upgrade URL: https://github.com/apache/directory-server/pull/1 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/http-integration/pom.xml b/http-integration/pom.xml index 022333607f..b3eb4d1732 100644 --- a/http-integration/pom.xml +++ b/http-integration/pom.xml @@ -74,19 +74,8 @@ - org.mortbay.jetty - jetty - - - - org.mortbay.jetty - servlet-api-2.5 - 6.1.14 - - - - org.mortbay.jetty - jetty-util + org.eclipse.jetty + jetty-webapp diff --git a/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java b/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java index 9f33ab41d7..45f6619021 100644 --- a/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java +++ b/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java @@ -31,8 +31,6 @@ import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.List; import java.util.Set; import java.util.UUID; @@ -46,13 +44,18 @@ import org.apache.directory.server.i18n.I18n; import org.apache.directory.server.protocol.shared.transport.TcpTransport; import org.bouncycastle.jce.provider.X509CertParser; -import org.mortbay.jetty.Handler; -import org.mortbay.jetty.Server; -import org.mortbay.jetty.handler.ContextHandler; -import org.mortbay.jetty.nio.SelectChannelConnector; -import org.mortbay.jetty.security.SslSocketConnector; -import org.mortbay.jetty.webapp.WebAppContext; -import org.mortbay.xml.XmlConfiguration; +import org.eclipse.jetty.server.Handler; +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.ServerConnector; +import org.eclipse.jetty.server.SslConnectionFactory; +import org.eclipse.jetty.server.handler.ContextHandler; +import org.eclipse.jetty.server.handler.HandlerList; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.xml.XmlConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -169,7 +172,7 @@ private void configureServerThroughCode() if ( httpTransport != null ) { - SelectChannelConnector httpConnector = new SelectChannelConnector(); + ServerConnector httpConnector = new ServerConnector( jetty ); httpConnector.setPort( httpTransport.getPort() ); httpConnector.setHost( httpTransport.getAddress() ); jetty.addConnector( httpConnector ); @@ -208,24 +211,31 @@ private void configureServerThroughCode() ks.store( stream, password.toCharArray() ); } - SslSocketConnector httpsConnector = new SslSocketConnector(); + SslContextFactory sslContextFactory = new SslContextFactory(); + sslContextFactory.setKeyStoreType( "JKS" ); + sslContextFactory.setKeyStorePath( ksFile.getAbsolutePath() ); + sslContextFactory.setKeyStorePassword( password ); + sslContextFactory.setKeyManagerPassword( password ); + + HttpConfiguration httpsConfiguration = new HttpConfiguration(); + httpsConfiguration.setSecureScheme( "https" ); + httpsConfiguration.setSecurePort( httpsTransport.getPort() ); + httpsConfiguration.addCustomizer( new SecureRequestCustomizer() ); + + ServerConnector httpsConnector = new ServerConnector( jetty, new SslConnectionFactory( sslContextFactory, "http/1.1" ), new HttpConnectionFactory( httpsConfiguration ) ); httpsConnector.setPort( httpsTransport.getPort() ); httpsConnector.setHost( httpsTransport.getAddress() ); - httpsConnector.setKeystoreType( ks.getType() ); - httpsConnector.setKeystore( ksFile.getAbsolutePath() ); - httpsConnector.setPassword( password ); - httpsConnector.setKeyPassword( password ); jetty.addConnector( httpsConnector ); } - List handlers = new ArrayList(); + HandlerList handlers = new HandlerList(); for ( WebApp w : webApps ) { WebAppContext webapp = new WebAppContext(); webapp.setWar( w.getWarFile() ); webapp.setContextPath( w.getContextPath() ); - handlers.add( webapp ); + handlers.addHandler( webapp ); webapp.setParentLoaderPriority( true ); } @@ -258,13 +268,13 @@ public boolean accept( File dir, String name ) } webapp.setContextPath( "/" + ctxName ); - handlers.add( webapp ); + handlers.addHandler( webapp ); webapp.setParentLoaderPriority( true ); } } - jetty.setHandlers( handlers.toArray( new Handler[handlers.size()] ) ); + jetty.setHandler( handlers ); configured = true; } diff --git a/pom.xml b/pom.xml index 4e75f2209d..7c253e5244 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 2.1.7 2.8.5 1.0.0 - 6.1.26 + 9.2.16.v20160414 4.12 4.1 1.2.17 @@ -1220,23 +1220,11 @@ - org.mortbay.jetty - jetty + org.eclipse.jetty + jetty-webapp ${jetty.version} - - org.mortbay.jetty - servlet-api-2.5 - 6.1.14 - - - - org.mortbay.jetty - jetty-util - ${jetty.version} - - findbugs annotations ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services