From 87b1003641677f378d795c41a126d9c8a031f204 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 8 Apr 2013 16:41:50 +0200 Subject: [PATCH] Removed module jetty-npn, it now lives in its own repository at http://git.eclipse.org/c/jetty/org.eclipse.jetty.npn.git. --- jetty-npn/pom.xml | 36 --- .../org/eclipse/jetty/npn/NextProtoNego.java | 248 ------------------ 2 files changed, 284 deletions(-) delete mode 100644 jetty-npn/pom.xml delete mode 100644 jetty-npn/src/main/java/org/eclipse/jetty/npn/NextProtoNego.java diff --git a/jetty-npn/pom.xml b/jetty-npn/pom.xml deleted file mode 100644 index f7bd5872e8a..00000000000 --- a/jetty-npn/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - org.eclipse.jetty - jetty-parent - 19 - - - 4.0.0 - org.eclipse.jetty.npn - npn-api - 1.1.1-SNAPSHOT - Jetty :: Next Protocol Negotiation :: API - - - scm:git:http://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project.git - scm:git:ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project.git - http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-npn - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.2.1 - - false - deploy - -Peclipse-release - clean install - - - - - diff --git a/jetty-npn/src/main/java/org/eclipse/jetty/npn/NextProtoNego.java b/jetty-npn/src/main/java/org/eclipse/jetty/npn/NextProtoNego.java deleted file mode 100644 index 6dbea165b5e..00000000000 --- a/jetty-npn/src/main/java/org/eclipse/jetty/npn/NextProtoNego.java +++ /dev/null @@ -1,248 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2013 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.npn; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLSocket; - -/** - *

{@link NextProtoNego} provides an API to applications that want to make use of the - * Next Protocol Negotiation.

- *

The NPN extension is only available when using the TLS protocol, therefore applications must - * ensure that the TLS protocol is used:

- *
- * SSLContext context = SSLContext.getInstance("TLSv1");
- * 
- *

Refer to the - * list - * of standard SSLContext protocol names for further information on TLS protocol versions supported.

- *

Applications must register instances of either {@link SSLSocket} or {@link SSLEngine} with a - * {@link ClientProvider} or with a {@link ServerProvider}, depending whether they are on client or - * server side.

- *

The NPN implementation will invoke the provider callbacks to allow applications to interact - * with the negotiation of the next protocol.

- *

Client side typical usage:

- *
- * SSLSocket sslSocket = ...;
- * NextProtoNego.put(sslSocket, new NextProtoNego.ClientProvider()
- * {
- *     @Override
- *     public boolean supports()
- *     {
- *         return true;
- *     }
- *
- *     @Override
- *     public void unsupported()
- *     {
- *     }
- *
- *     @Override
- *     public String selectProtocol(List<String> protocols)
- *     {
- *         return protocols.get(0);
- *     }
- *  });
- * 
- *

Server side typical usage:

- *
- * SSLSocket sslSocket = ...;
- * NextProtoNego.put(sslSocket, new NextProtoNego.ServerProvider()
- * {
- *     @Override
- *     public void unsupported()
- *     {
- *     }
- *
- *     @Override
- *     public List protocols()
- *     {
- *         return Arrays.asList("http/1.1");
- *     }
- *
- *     @Override
- *     public void protocolSelected(String protocol)
- *     {
- *         System.out.println("Protocol Selected is: " + protocol);
- *     }
- *  });
- * 
- *

There is no need to unregister {@link SSLSocket} or {@link SSLEngine} instances, as they - * are kept in a {@link WeakHashMap} and will be garbage collected when the application does not - * hard reference them anymore. However, methods to explicitly unregister {@link SSLSocket} or - * {@link SSLEngine} instances are provided.

- *

In order to help application development, you can set the {@link NextProtoNego#debug} field - * to {@code true} to have debug code printed to {@link System#err}.

- */ -public class NextProtoNego -{ - /** - *

Enables debug logging on {@link System#err}.

- */ - public static boolean debug = false; - - private static Map objects = Collections.synchronizedMap(new WeakHashMap()); - - private NextProtoNego() - { - } - - /** - *

Registers a SSLSocket with a provider.

- * - * @param socket the socket to register with the provider - * @param provider the provider to register with the socket - * @see #remove(SSLSocket) - */ - public static void put(SSLSocket socket, Provider provider) - { - objects.put(socket, provider); - } - - /** - * @param socket a socket registered with {@link #put(SSLSocket, Provider)} - * @return the provider registered with the given socket - */ - public static Provider get(SSLSocket socket) - { - return objects.get(socket); - } - - /** - *

Unregisters the given SSLSocket.

- * - * @param socket the socket to unregister - * @return the provider registered with the socket - * @see #put(SSLSocket, Provider) - */ - public static Provider remove(SSLSocket socket) - { - return objects.remove(socket); - } - - /** - *

Registers a SSLEngine with a provider.

- * - * @param engine the engine to register with the provider - * @param provider the provider to register with the engine - * @see #remove(SSLEngine) - */ - public static void put(SSLEngine engine, Provider provider) - { - objects.put(engine, provider); - } - - /** - * - * @param engine an engine registered with {@link #put(SSLEngine, Provider)} - * @return the provider registered with the given engine - */ - public static Provider get(SSLEngine engine) - { - return objects.get(engine); - } - - /** - *

Unregisters the given SSLEngine.

- * - * @param engine the engine to unregister - * @return the provider registered with the engine - * @see #put(SSLEngine, Provider) - */ - public static Provider remove(SSLEngine engine) - { - return objects.remove(engine); - } - - /** - *

Base, empty, interface for providers.

- */ - public interface Provider - { - } - - /** - *

The client-side provider interface that applications must implement to interact - * with the negotiation of the next protocol.

- */ - public interface ClientProvider extends Provider - { - /** - *

Callback invoked to let the implementation know whether an - * empty NPN extension should be added to a ClientHello SSL message.

- * - * @return true to add the NPN extension, false otherwise - */ - public boolean supports(); - - /** - *

Callback invoked to let the application know that the server does - * not support NPN.

- */ - public void unsupported(); - - /** - *

Callback invoked to let the application select a protocol - * among the ones sent by the server.

- * - * @param protocols the protocols sent by the server - * @return the protocol selected by the application, or null if the - * NextProtocol SSL message should not be sent to the server - */ - public String selectProtocol(List protocols); - } - - /** - *

The server-side provider interface that applications must implement to interact - * with the negotiation of the next protocol.

- */ - public interface ServerProvider extends Provider - { - /** - *

Callback invoked to let the application know that the client does not - * support NPN.

- */ - public void unsupported(); - - /** - *

Callback invoked to let the implementation know the list - * of protocols that should be added to an NPN extension in a - * ServerHello SSL message.

- *

This callback is invoked only if the client sent a NPN extension.

- * - * @return the list of protocols, or null if no NPN extension - * should be sent to the client - */ - public List protocols(); - - /** - *

Callback invoked to let the application know the protocol selected - * by the client.

- *

This callback is invoked only if the client sent a NextProtocol SSL message.

- * - * @param protocol the selected protocol - */ - public void protocolSelected(String protocol); - } -}