Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.
This commit is contained in:
commit
e539d0b1fd
|
@ -46,7 +46,6 @@ import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
|
|||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
@ -56,7 +55,6 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.servlets.PushCacheFilter;
|
||||
import org.eclipse.jetty.servlets.PushSessionCacheFilter;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
|
||||
|
@ -109,7 +107,6 @@ public class Http2Server
|
|||
// HTTP/2 Connection Factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(http.getDefaultProtocol());
|
||||
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
package org.eclipse.jetty.alpn.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
@ -29,27 +31,58 @@ import org.eclipse.jetty.io.ClientConnectionFactory;
|
|||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.NegotiatingClientConnectionFactory;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
import org.eclipse.jetty.io.ssl.SslClientConnectionFactory;
|
||||
import org.eclipse.jetty.io.ssl.SslHandshakeListener;
|
||||
import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
||||
|
||||
public class ALPNClientConnectionFactory extends NegotiatingClientConnectionFactory
|
||||
public class ALPNClientConnectionFactory extends NegotiatingClientConnectionFactory implements SslHandshakeListener
|
||||
{
|
||||
private final SslHandshakeListener alpnListener = new ALPNListener();
|
||||
private final Executor executor;
|
||||
private final List<String> protocols;
|
||||
private final ALPNProcessor.Client alpnProcessor;
|
||||
|
||||
public ALPNClientConnectionFactory(Executor executor, ClientConnectionFactory connectionFactory, List<String> protocols)
|
||||
{
|
||||
super(connectionFactory);
|
||||
this.executor = executor;
|
||||
this.protocols = protocols;
|
||||
if (protocols.isEmpty())
|
||||
throw new IllegalArgumentException("ALPN protocol list cannot be empty");
|
||||
this.executor = executor;
|
||||
this.protocols = protocols;
|
||||
Iterator<ALPNProcessor.Client> processors = ServiceLoader.load(ALPNProcessor.Client.class).iterator();
|
||||
alpnProcessor = processors.hasNext() ? processors.next() : ALPNProcessor.Client.NOOP;
|
||||
}
|
||||
|
||||
public ALPNProcessor.Client getALPNProcessor()
|
||||
{
|
||||
return alpnProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection newConnection(EndPoint endPoint, Map<String, Object> context) throws IOException
|
||||
{
|
||||
SSLEngine sslEngine = (SSLEngine)context.get(SslClientConnectionFactory.SSL_ENGINE_CONTEXT_KEY);
|
||||
getALPNProcessor().configure(sslEngine, protocols);
|
||||
ContainerLifeCycle connector = (ContainerLifeCycle)context.get(ClientConnectionFactory.CONNECTOR_CONTEXT_KEY);
|
||||
// Method addBean() has set semantic, so the listener is added only once.
|
||||
connector.addBean(alpnListener);
|
||||
ALPNClientConnection connection = new ALPNClientConnection(endPoint, executor, getClientConnectionFactory(),
|
||||
(SSLEngine)context.get(SslClientConnectionFactory.SSL_ENGINE_CONTEXT_KEY), context, protocols);
|
||||
sslEngine, context, protocols);
|
||||
return customize(connection, context);
|
||||
}
|
||||
|
||||
private class ALPNListener implements SslHandshakeListener
|
||||
{
|
||||
@Override
|
||||
public void handshakeSucceeded(Event event)
|
||||
{
|
||||
getALPNProcessor().process(event.getSSLEngine());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handshakeFailed(Event event, Throwable failure)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-parent</artifactId>
|
||||
<version>9.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-alpn-java-client</artifactId>
|
||||
<name>Jetty :: ALPN :: JDK9 Client Implementation</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.alpn.java.client</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.9</source>
|
||||
<target>1.9</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-io</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.http2</groupId>
|
||||
<artifactId>http2-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,54 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.alpn.java.client;
|
||||
|
||||
import java.io.UncheckedIOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
import javax.net.ssl.SSLException;
|
||||
import javax.net.ssl.SSLParameters;
|
||||
|
||||
import org.eclipse.jetty.alpn.ALPN;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
|
||||
public class JDK9ClientALPNProcessor implements ALPNProcessor.Client
|
||||
{
|
||||
@Override
|
||||
public void configure(SSLEngine sslEngine, List<String> protocols)
|
||||
{
|
||||
SSLParameters sslParameters = sslEngine.getSSLParameters();
|
||||
sslParameters.setApplicationProtocols(protocols.toArray(new String[0]));
|
||||
sslEngine.setSSLParameters(sslParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(SSLEngine sslEngine)
|
||||
{
|
||||
try
|
||||
{
|
||||
ALPN.ClientProvider provider = (ALPN.ClientProvider)ALPN.get(sslEngine);
|
||||
provider.selected(sslEngine.getApplicationProtocol());
|
||||
}
|
||||
catch (SSLException x)
|
||||
{
|
||||
throw new UncheckedIOException(x);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.jetty.alpn.java.client.JDK9ClientALPNProcessor
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.alpn.java.client;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpURI;
|
||||
import org.eclipse.jetty.http.HttpVersion;
|
||||
import org.eclipse.jetty.http.MetaData;
|
||||
import org.eclipse.jetty.http2.api.Session;
|
||||
import org.eclipse.jetty.http2.api.Stream;
|
||||
import org.eclipse.jetty.http2.client.HTTP2Client;
|
||||
import org.eclipse.jetty.http2.frames.DataFrame;
|
||||
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.FuturePromise;
|
||||
import org.eclipse.jetty.util.Jetty;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class JDK9HTTP2Client
|
||||
{
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
HTTP2Client client = new HTTP2Client();
|
||||
SslContextFactory sslContextFactory = new SslContextFactory(true);
|
||||
client.addBean(sslContextFactory);
|
||||
client.start();
|
||||
|
||||
String host = "localhost";
|
||||
int port = 8443;
|
||||
|
||||
FuturePromise<Session> sessionPromise = new FuturePromise<>();
|
||||
client.connect(sslContextFactory, new InetSocketAddress(host, port), new Session.Listener.Adapter(), sessionPromise);
|
||||
Session session = sessionPromise.get(555, TimeUnit.SECONDS);
|
||||
|
||||
HttpFields requestFields = new HttpFields();
|
||||
requestFields.put("User-Agent", client.getClass().getName() + "/" + Jetty.VERSION);
|
||||
MetaData.Request metaData = new MetaData.Request("GET", new HttpURI("https://" + host + ":" + port + "/"), HttpVersion.HTTP_2, requestFields);
|
||||
HeadersFrame headersFrame = new HeadersFrame(metaData, null, true);
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
session.newStream(headersFrame, new Promise.Adapter<>(), new Stream.Listener.Adapter()
|
||||
{
|
||||
@Override
|
||||
public void onHeaders(Stream stream, HeadersFrame frame)
|
||||
{
|
||||
System.err.println(frame);
|
||||
if (frame.isEndStream())
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onData(Stream stream, DataFrame frame, Callback callback)
|
||||
{
|
||||
System.err.println(frame);
|
||||
callback.succeeded();
|
||||
if (frame.isEndStream())
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
|
||||
latch.await(5, TimeUnit.SECONDS);
|
||||
|
||||
client.stop();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||
#org.eclipse.jetty.LEVEL=DEBUG
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-parent</artifactId>
|
||||
<version>9.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-alpn-java-server</artifactId>
|
||||
<name>Jetty :: ALPN :: JDK9 Server Implementation</name>
|
||||
|
||||
<properties>
|
||||
<bundle-symbolic-name>${project.groupId}.alpn.java.server</bundle-symbolic-name>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.9</source>
|
||||
<target>1.9</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-io</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.http2</groupId>
|
||||
<artifactId>http2-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.alpn.java.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
import org.eclipse.jetty.alpn.ALPN;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
|
||||
public class JDK9ServerALPNProcessor implements ALPNProcessor.Server
|
||||
{
|
||||
@Override
|
||||
public void configure(SSLEngine sslEngine)
|
||||
{
|
||||
sslEngine.setHandshakeApplicationProtocolSelector(this::process);
|
||||
}
|
||||
|
||||
private String process(SSLEngine sslEngine, List<String> protocols)
|
||||
{
|
||||
try
|
||||
{
|
||||
ALPN.ServerProvider provider = (ALPN.ServerProvider)ALPN.get(sslEngine);
|
||||
return provider.select(protocols);
|
||||
}
|
||||
catch (SSLException x)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.jetty.alpn.java.server.JDK9ServerALPNProcessor
|
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.alpn.java.server;
|
||||
|
||||
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
|
||||
import org.eclipse.jetty.http2.HTTP2Cipher;
|
||||
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
|
||||
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.util.ssl.SslContextFactory;
|
||||
|
||||
/**
|
||||
* Test server that verifies that the JDK 9 ALPN mechanism works.
|
||||
*/
|
||||
public class JDK9HTTP2Server
|
||||
{
|
||||
public static void main(String... args) throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
|
||||
HttpConfiguration httpsConfig = new HttpConfiguration();
|
||||
httpsConfig.setSecureScheme("https");
|
||||
httpsConfig.setSecurePort(8443);
|
||||
httpsConfig.setSendXPoweredBy(true);
|
||||
httpsConfig.setSendServerVersion(true);
|
||||
httpsConfig.addCustomizer(new SecureRequestCustomizer());
|
||||
|
||||
SslContextFactory sslContextFactory = new SslContextFactory();
|
||||
sslContextFactory.setKeyStorePath("src/test/resources/keystore.jks");
|
||||
sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
|
||||
sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
|
||||
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
|
||||
|
||||
HttpConnectionFactory http = new HttpConnectionFactory(httpsConfig);
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(http.getProtocol());
|
||||
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, alpn.getProtocol());
|
||||
|
||||
ServerConnector http2Connector = new ServerConnector(server, ssl, alpn, h2, http);
|
||||
http2Connector.setPort(8443);
|
||||
server.addConnector(http2Connector);
|
||||
|
||||
server.start();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||
#org.eclipse.jetty.LEVEL=DEBUG
|
Binary file not shown.
|
@ -0,0 +1,28 @@
|
|||
[description]
|
||||
Provides ALPN support for JDK 8, modifying the sun.security.ssl
|
||||
classes and adding them to the JVM boot classpath.
|
||||
This modification has a tight dependency on specific recent updates of
|
||||
Java 1.7 and Java 1.8 (Java versions prior to 1.7u40 are not supported).
|
||||
This module will use an appropriate alpn-boot jar for your
|
||||
specific version of Java.
|
||||
# IMPORTANT: Versions of Java that exist after this module was created are
|
||||
# not guaranteed to work with existing alpn-boot jars, and might
|
||||
# need a new alpn-boot to be created / tested / deployed by the
|
||||
# Jetty project in order to provide support for these future
|
||||
# Java versions.
|
||||
#
|
||||
# All versions of the alpn-boot can be found at
|
||||
# http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/
|
||||
|
||||
[depend]
|
||||
alpn-impl/alpn-${java.version}
|
||||
|
||||
[files]
|
||||
lib/
|
||||
lib/alpn/
|
||||
|
||||
[license]
|
||||
ALPN is a hosted at github under the GPL v2 with ClassPath Exception.
|
||||
ALPN replaces/modifies OpenJDK classes in the sun.security.ssl package.
|
||||
http://github.com/jetty-project/jetty-alpn
|
||||
http://openjdk.java.net/legal/gplv2+ce.html
|
|
@ -0,0 +1,6 @@
|
|||
[description]
|
||||
Provides support for ALPN based on JDK 9 APIs.
|
||||
|
||||
[lib]
|
||||
lib/jetty-alpn-java-server-${jetty.version}.jar
|
||||
lib/alpn-api-*.jar
|
|
@ -1,23 +1,9 @@
|
|||
[description]
|
||||
Enables the ALPN extension to TLS(SSL) by adding modified classes to
|
||||
the JVM bootpath.
|
||||
This modification has a tight dependency on specific recent updates of
|
||||
Java 1.7 and Java 1.8 (Java versions prior to 1.7u40 are not supported).
|
||||
The alpn module will use an appropriate alpn-boot jar for your
|
||||
specific version of Java.
|
||||
#
|
||||
# IMPORTANT: Versions of Java that exist after this module was created are
|
||||
# not guaranteed to work with existing alpn-boot jars, and might
|
||||
# need a new alpn-boot to be created / tested / deployed by the
|
||||
# Jetty project in order to provide support for these future
|
||||
# Java versions.
|
||||
#
|
||||
# All versions of alpn-boot can be found at
|
||||
# http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/
|
||||
Enables the ALPN (Application Layer Protocol Negotiation) TLS extension.
|
||||
|
||||
[depend]
|
||||
ssl
|
||||
alpn-impl/alpn-${java.version}
|
||||
alpn-impl/alpn-${java.version.platform}
|
||||
|
||||
[lib]
|
||||
lib/jetty-alpn-client-${jetty.version}.jar
|
||||
|
@ -26,15 +12,11 @@ lib/jetty-alpn-server-${jetty.version}.jar
|
|||
[xml]
|
||||
etc/jetty-alpn.xml
|
||||
|
||||
[files]
|
||||
lib/
|
||||
lib/alpn/
|
||||
|
||||
[ini-template]
|
||||
## Overrides the order protocols are chosen by the server.
|
||||
## The default order is that specified by the order of the
|
||||
## modules declared in start.ini.
|
||||
# jetty.alpn.protocols=h2-16,http/1.1
|
||||
# jetty.alpn.protocols=h2,http/1.1
|
||||
|
||||
## Specifies what protocol to use when negotiation fails.
|
||||
# jetty.alpn.defaultProtocol=http/1.1
|
||||
|
@ -42,8 +24,3 @@ lib/alpn/
|
|||
## ALPN debug logging on System.err
|
||||
# jetty.alpn.debug=false
|
||||
|
||||
[license]
|
||||
ALPN is a hosted at github under the GPL v2 with ClassPath Exception.
|
||||
ALPN replaces/modifies OpenJDK classes in the java.sun.security.ssl package.
|
||||
http://github.com/jetty-project/jetty-alpn
|
||||
http://openjdk.java.net/legal/gplv2+ce.html
|
||||
|
|
|
@ -18,22 +18,22 @@
|
|||
|
||||
package org.eclipse.jetty.alpn.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
||||
import org.eclipse.jetty.alpn.ALPN;
|
||||
import org.eclipse.jetty.io.AbstractConnection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.ssl.ALPNProcessor;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.util.annotation.Name;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
public class ALPNServerConnectionFactory extends NegotiatingServerConnectionFactory
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(ALPNServerConnectionFactory.class);
|
||||
private final ALPNProcessor.Server alpnProcessor;
|
||||
|
||||
public ALPNServerConnectionFactory(String protocols)
|
||||
{
|
||||
|
@ -43,25 +43,20 @@ public class ALPNServerConnectionFactory extends NegotiatingServerConnectionFact
|
|||
public ALPNServerConnectionFactory(@Name("protocols") String... protocols)
|
||||
{
|
||||
super("alpn", protocols);
|
||||
try
|
||||
{
|
||||
ClassLoader alpnClassLoader = ALPN.class.getClassLoader();
|
||||
if (alpnClassLoader != null)
|
||||
{
|
||||
LOG.warn("ALPN must be in the boot classloader, not in: " + alpnClassLoader);
|
||||
throw new IllegalStateException("ALPN must be in the boot classloader");
|
||||
}
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
LOG.warn("ALPN not available", x);
|
||||
throw new IllegalStateException("ALPN not available", x);
|
||||
}
|
||||
checkProtocolNegotiationAvailable();
|
||||
Iterator<ALPNProcessor.Server> processors = ServiceLoader.load(ALPNProcessor.Server.class).iterator();
|
||||
alpnProcessor = processors.hasNext() ? processors.next() : ALPNProcessor.Server.NOOP;
|
||||
}
|
||||
|
||||
public ALPNProcessor.Server getALPNProcessor()
|
||||
{
|
||||
return alpnProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractConnection newServerConnection(Connector connector, EndPoint endPoint, SSLEngine engine, List<String> protocols, String defaultProtocol)
|
||||
{
|
||||
getALPNProcessor().configure(engine);
|
||||
return new ALPNServerConnection(connector, endPoint, engine, protocols, defaultProtocol);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
|
@ -12,4 +14,16 @@
|
|||
<module>jetty-alpn-server</module>
|
||||
<module>jetty-alpn-client</module>
|
||||
</modules>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk9</id>
|
||||
<activation>
|
||||
<jdk>[1.9,)</jdk>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>jetty-alpn-java-client</module>
|
||||
<module>jetty-alpn-java-server</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>9.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jetty-distribution</artifactId>
|
||||
<name>Jetty :: Distribution Assemblies</name>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<assembly-directory>${basedir}/target/distribution</assembly-directory>
|
||||
<home-directory>${basedir}/target/home</home-directory>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!--
|
||||
|
@ -74,7 +77,7 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>removeKeystore</id>
|
||||
<id>removeKeystore</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
|
@ -393,6 +396,7 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.jetty.http2.HTTP2Cipher;
|
|||
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -54,7 +53,6 @@ public class DrupalHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.jetty.http2.HTTP2Cipher;
|
|||
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -61,7 +60,6 @@ public class WordPressHTTP2FastCGIProxyServer
|
|||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
|
|
@ -590,4 +590,21 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk9</id>
|
||||
<activation>
|
||||
<jdk>[1.9,)</jdk>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-java-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -49,22 +49,36 @@
|
|||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar
|
||||
</argLine>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk9</id>
|
||||
<activation>
|
||||
<jdk>[1.9,)</jdk>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.alpn</groupId>
|
||||
<artifactId>alpn-api</artifactId>
|
||||
<version>${alpn.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-alpn-server</artifactId>
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar
|
||||
</argLine>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.io.ssl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
|
||||
public interface ALPNProcessor
|
||||
{
|
||||
public interface Server
|
||||
{
|
||||
public static final ALPNProcessor.Server NOOP = new ALPNProcessor.Server()
|
||||
{
|
||||
};
|
||||
|
||||
public default void configure(SSLEngine sslEngine)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public interface Client
|
||||
{
|
||||
public static final Client NOOP = new Client()
|
||||
{
|
||||
};
|
||||
|
||||
public default void configure(SSLEngine sslEngine, List<String> protocols)
|
||||
{
|
||||
}
|
||||
|
||||
public default void process(SSLEngine sslEngine)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,11 +63,11 @@ public class SslClientConnectionFactory implements ClientConnectionFactory
|
|||
SslConnection sslConnection = newSslConnection(byteBufferPool, executor, endPoint, engine);
|
||||
endPoint.setConnection(sslConnection);
|
||||
|
||||
customize(sslConnection, context);
|
||||
|
||||
EndPoint appEndPoint = sslConnection.getDecryptedEndPoint();
|
||||
appEndPoint.setConnection(connectionFactory.newConnection(appEndPoint, context));
|
||||
|
||||
customize(sslConnection, context);
|
||||
|
||||
return sslConnection;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-project</artifactId>
|
||||
<version>9.4.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.eclipse.jetty.osgi</groupId>
|
||||
<artifactId>jetty-osgi-project</artifactId>
|
||||
<name>Jetty :: OSGi</name>
|
||||
<url>http://www.eclipse.org/jetty</url>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<osgi-version>3.6.0.v20100517</osgi-version>
|
||||
<osgi-services-version>3.2.100.v20100503</osgi-services-version>
|
||||
|
@ -18,6 +22,7 @@
|
|||
<logback-version>0.9.29</logback-version>
|
||||
<slf4j-version>1.6.1</slf4j-version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>jetty-osgi-boot</module>
|
||||
<module>jetty-osgi-boot-jsp</module>
|
||||
|
@ -28,8 +33,20 @@
|
|||
<module>test-jetty-osgi-fragment</module>
|
||||
<module>test-jetty-osgi-server</module>
|
||||
<module>jetty-osgi-alpn</module>
|
||||
<module>test-jetty-osgi</module>
|
||||
</modules>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk9</id>
|
||||
<activation>
|
||||
<jdk>[1.8,1.9)</jdk>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>test-jetty-osgi</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
|
@ -79,6 +96,7 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -180,4 +198,5 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.eclipse.jetty.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -34,23 +33,25 @@ import org.eclipse.jetty.io.ssl.SslConnection;
|
|||
public abstract class NegotiatingServerConnectionFactory extends AbstractConnectionFactory
|
||||
{
|
||||
public static void checkProtocolNegotiationAvailable()
|
||||
{
|
||||
if (!isAvailableInBootClassPath("org.eclipse.jetty.alpn.ALPN"))
|
||||
throw new IllegalStateException("No ALPN classes available");
|
||||
}
|
||||
|
||||
private static boolean isAvailableInBootClassPath(String className)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> klass = ClassLoader.getSystemClassLoader().loadClass(className);
|
||||
if (klass.getClassLoader() != null)
|
||||
throw new IllegalStateException(className + " must be on JVM boot classpath");
|
||||
return true;
|
||||
String javaVersion = System.getProperty("java.version");
|
||||
String alpnClassName = "org.eclipse.jetty.alpn.ALPN";
|
||||
if (javaVersion.startsWith("1."))
|
||||
{
|
||||
Class<?> klass = ClassLoader.getSystemClassLoader().loadClass(alpnClassName);
|
||||
if (klass.getClassLoader() != null)
|
||||
throw new IllegalStateException(alpnClassName + " must be on JVM boot classpath");
|
||||
}
|
||||
else
|
||||
{
|
||||
NegotiatingServerConnectionFactory.class.getClassLoader().loadClass(alpnClassName);
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException x)
|
||||
{
|
||||
return false;
|
||||
throw new IllegalStateException("No ALPN classes available");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class JavaVersion
|
||||
{
|
||||
private static final Pattern PRE_JDK9 = Pattern.compile("1\\.(\\d)(\\.(\\d+)(_(\\d+))?)?(-.+)?");
|
||||
// Regexp from JEP 223 (http://openjdk.java.net/jeps/223).
|
||||
private static final Pattern JDK9 = Pattern.compile("(\\d+)(\\.(\\d+))?(\\.(\\d+))?((-.+)?(\\+(\\d+)?(-.+)?)?)");
|
||||
|
||||
public static JavaVersion parse(String version)
|
||||
{
|
||||
if (version.startsWith("1."))
|
||||
return parsePreJDK9(version);
|
||||
return parseJDK9(version);
|
||||
}
|
||||
|
||||
private static JavaVersion parsePreJDK9(String version)
|
||||
{
|
||||
Matcher matcher = PRE_JDK9.matcher(version);
|
||||
if (!matcher.matches())
|
||||
throw new IllegalArgumentException("Invalid Java version " + version);
|
||||
int major = 1;
|
||||
int minor = Integer.parseInt(matcher.group(1));
|
||||
String microGroup = matcher.group(3);
|
||||
int micro = microGroup == null || microGroup.isEmpty() ? 0 : Integer.parseInt(microGroup);
|
||||
String updateGroup = matcher.group(5);
|
||||
int update = updateGroup == null || updateGroup.isEmpty() ? 0 : Integer.parseInt(updateGroup);
|
||||
String suffix = matcher.group(6);
|
||||
return new JavaVersion(version, minor, major, minor, micro, update, suffix);
|
||||
}
|
||||
|
||||
private static JavaVersion parseJDK9(String version)
|
||||
{
|
||||
Matcher matcher = JDK9.matcher(version);
|
||||
if (!matcher.matches())
|
||||
throw new IllegalArgumentException("Invalid Java version " + version);
|
||||
int major = Integer.parseInt(matcher.group(1));
|
||||
String minorGroup = matcher.group(3);
|
||||
int minor = minorGroup == null || minorGroup.isEmpty() ? 0 : Integer.parseInt(minorGroup);
|
||||
String microGroup = matcher.group(5);
|
||||
int micro = microGroup == null || microGroup.isEmpty() ? 0 : Integer.parseInt(microGroup);
|
||||
String suffix = matcher.group(6);
|
||||
return new JavaVersion(version, major, major, minor, micro, 0, suffix);
|
||||
}
|
||||
|
||||
private final String version;
|
||||
private final int platform;
|
||||
private final int major;
|
||||
private final int minor;
|
||||
private final int micro;
|
||||
private final int update;
|
||||
private final String suffix;
|
||||
|
||||
private JavaVersion(String version, int platform, int major, int minor, int micro, int update, String suffix)
|
||||
{
|
||||
this.version = version;
|
||||
this.platform = platform;
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.micro = micro;
|
||||
this.update = update;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the string from which this JavaVersion was created
|
||||
*/
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the Java Platform version, such as {@code 8} for JDK 1.8.0_92 and {@code 9} for JDK 9.2.4.</p>
|
||||
*
|
||||
* @return the Java Platform version
|
||||
*/
|
||||
public int getPlatform()
|
||||
{
|
||||
return platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the major number version, such as {@code 1} for JDK 1.8.0_92 and {@code 9} for JDK 9.2.4.</p>
|
||||
*
|
||||
* @return the major number version
|
||||
*/
|
||||
public int getMajor()
|
||||
{
|
||||
return major;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the minor number version, such as {@code 8} for JDK 1.8.0_92 and {@code 2} for JDK 9.2.4.</p>
|
||||
*
|
||||
* @return the minor number version
|
||||
*/
|
||||
public int getMinor()
|
||||
{
|
||||
return minor;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the micro number version, such as {@code 0} for JDK 1.8.0_92 and {@code 4} for JDK 9.2.4.</p>
|
||||
*
|
||||
* @return the micro number version
|
||||
*/
|
||||
public int getMicro()
|
||||
{
|
||||
return micro;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the update number version, such as {@code 92} for JDK 1.8.0_92 and {@code 0} for JDK 9.2.4.</p>
|
||||
*
|
||||
* @return the update number version
|
||||
*/
|
||||
public int getUpdate()
|
||||
{
|
||||
return update;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the remaining string after the version numbers, such as {@code -internal} for
|
||||
* JDK 1.8.0_92-internal and {@code -ea} for JDK 9-ea, or {@code +13} for JDK 9.2.4+13.</p>
|
||||
*
|
||||
* @return the remaining string after the version numbers
|
||||
*/
|
||||
public String getSuffix()
|
||||
{
|
||||
return suffix;
|
||||
}
|
||||
}
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_BAD_ARG;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -180,7 +178,6 @@ public class StartArgs
|
|||
private boolean createStartd = false;
|
||||
private boolean updateIni = false;
|
||||
|
||||
|
||||
private boolean exec = false;
|
||||
private String exec_properties;
|
||||
private boolean approveAllLicenses = false;
|
||||
|
@ -438,7 +435,7 @@ public class StartArgs
|
|||
}
|
||||
|
||||
/**
|
||||
* Expand any command line added <code>--lib</code> lib references.
|
||||
* Expand any command line added {@code --lib} lib references.
|
||||
*
|
||||
* @throws IOException
|
||||
* if unable to expand the libraries
|
||||
|
@ -861,7 +858,7 @@ public class StartArgs
|
|||
Path commands = baseHome.getPath(Props.getValue(arg));
|
||||
|
||||
if (!Files.exists(commands) || !Files.isReadable(commands))
|
||||
throw new UsageException(ERR_BAD_ARG,"--commands file must be readable: %s",commands);
|
||||
throw new UsageException(UsageException.ERR_BAD_ARG,"--commands file must be readable: %s",commands);
|
||||
try
|
||||
{
|
||||
TextFile file = new TextFile(commands);
|
||||
|
@ -947,7 +944,7 @@ public class StartArgs
|
|||
{
|
||||
exec_properties = Props.getValue(arg);
|
||||
if (!exec_properties.endsWith(".properties"))
|
||||
throw new UsageException(ERR_BAD_ARG,"--exec-properties filename must have .properties suffix: %s",exec_properties);
|
||||
throw new UsageException(UsageException.ERR_BAD_ARG,"--exec-properties filename must have .properties suffix: %s",exec_properties);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1109,6 @@ public class StartArgs
|
|||
key = key.substring(0,key.length() - 1);
|
||||
if (getProperties().containsKey(key))
|
||||
return;
|
||||
|
||||
}
|
||||
else if (propertySource.containsKey(key))
|
||||
{
|
||||
|
@ -1147,7 +1143,7 @@ public class StartArgs
|
|||
}
|
||||
|
||||
// Anything else is unrecognized
|
||||
throw new UsageException(ERR_BAD_ARG,"Unrecognized argument: \"%s\" in %s",arg,source);
|
||||
throw new UsageException(UsageException.ERR_BAD_ARG,"Unrecognized argument: \"%s\" in %s",arg,source);
|
||||
}
|
||||
|
||||
private void enableModules(String source, List<String> moduleNames)
|
||||
|
@ -1158,7 +1154,7 @@ public class StartArgs
|
|||
List<String> list = sources.get(moduleName);
|
||||
if (list == null)
|
||||
{
|
||||
list = new ArrayList<String>();
|
||||
list = new ArrayList<>();
|
||||
sources.put(moduleName,list);
|
||||
}
|
||||
list.add(source);
|
||||
|
@ -1219,13 +1215,20 @@ public class StartArgs
|
|||
properties.setProperty(key,value,source);
|
||||
if (key.equals("java.version"))
|
||||
{
|
||||
Version ver = new Version(value);
|
||||
|
||||
properties.setProperty("java.version",ver.toShortString(),source);
|
||||
properties.setProperty("java.version.major",Integer.toString(ver.getLegacyMajor()),source);
|
||||
properties.setProperty("java.version.minor",Integer.toString(ver.getMajor()),source);
|
||||
properties.setProperty("java.version.revision",Integer.toString(ver.getRevision()),source);
|
||||
properties.setProperty("java.version.update",Integer.toString(ver.getUpdate()),source);
|
||||
try
|
||||
{
|
||||
JavaVersion ver = JavaVersion.parse(value);
|
||||
properties.setProperty("java.version",ver.getVersion(),source);
|
||||
properties.setProperty("java.version.platform",Integer.toString(ver.getPlatform()),source);
|
||||
properties.setProperty("java.version.major",Integer.toString(ver.getMajor()),source);
|
||||
properties.setProperty("java.version.minor",Integer.toString(ver.getMinor()),source);
|
||||
properties.setProperty("java.version.micro",Integer.toString(ver.getMicro()),source);
|
||||
properties.setProperty("java.version.update",Integer.toString(ver.getUpdate()),source);
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
throw new UsageException(UsageException.ERR_BAD_ARG, x.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1249,5 +1252,4 @@ public class StartArgs
|
|||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TestBadUseCases
|
|||
List<Object[]> ret = new ArrayList<>();
|
||||
|
||||
ret.add(new Object[]{ "http2",
|
||||
"Missing referenced dependency: alpn-impl/alpn-0.0.0_0",
|
||||
"Invalid Java version",
|
||||
new String[]{"java.version=0.0.0_0"}});
|
||||
|
||||
ret.add(new Object[]{ "versioned-modules-too-new",
|
||||
|
|
80
pom.xml
80
pom.xml
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
|
@ -39,7 +41,6 @@
|
|||
<connection>scm:git:https://github.com/eclipse/jetty.project.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:eclipse/jetty.project.git</developerConnection>
|
||||
<url>https://github.com/eclipse/jetty.project</url>
|
||||
<tag>jetty-9.3.13.M0</tag>
|
||||
</scm>
|
||||
|
||||
<modules>
|
||||
|
@ -150,7 +151,6 @@
|
|||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.7.7.201606060606</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<!-- build tools -->
|
||||
|
@ -366,15 +366,10 @@
|
|||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-version-maven-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>3.0.0</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
|
@ -386,7 +381,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
|
@ -395,7 +390,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -418,7 +413,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
|
@ -433,7 +428,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.3</version>
|
||||
<version>2.10.4</version>
|
||||
<configuration>
|
||||
<docfilessubdirs>true</docfilessubdirs>
|
||||
<detectLinks>true</detectLinks>
|
||||
|
@ -526,12 +521,12 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>3.4</version>
|
||||
<version>3.5</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>3.6</version>
|
||||
<version>3.7</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -561,12 +556,12 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.6</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.0.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -587,7 +582,17 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-version-maven-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.7.8</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.agilejava.docbkx</groupId>
|
||||
|
@ -635,17 +640,17 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>appassembler-maven-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>2.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<version>1.12</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>clirr-maven-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>2.8</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
|
@ -655,7 +660,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<version>3.0.4</version>
|
||||
<configuration>
|
||||
<findbugsXmlOutput>true</findbugsXmlOutput>
|
||||
<xmlOutput>true</xmlOutput>
|
||||
|
@ -1014,37 +1019,6 @@
|
|||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk9</id>
|
||||
<activation>
|
||||
<jdk>[1.9,)</jdk>
|
||||
</activation>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache-plugins-snapshots</id>
|
||||
<url>https://repository.apache.org/content/groups/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>config</id>
|
||||
<activation>
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar
|
||||
</argLine>
|
||||
<argLine>-Xbootclasspath/p:${project.build.directory}/alpn/alpn-boot-${alpn.version}.jar</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
|||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.NegotiatingServerConnectionFactory;
|
||||
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
|
@ -106,7 +105,6 @@ public class TestTransparentProxyServer
|
|||
|
||||
// HTTP2 factory
|
||||
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(https_config);
|
||||
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
|
||||
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
|
||||
alpn.setDefaultProtocol(h2.getProtocol());
|
||||
|
||||
|
|
Loading…
Reference in New Issue