Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-9.4.x-43…
Browse files Browse the repository at this point in the history
…31-asyncCloseComplete3
  • Loading branch information
gregw committed Dec 18, 2019
2 parents f407df3 + fcc18b0 commit 6872c33
Show file tree
Hide file tree
Showing 35 changed files with 1,841 additions and 297 deletions.
130 changes: 57 additions & 73 deletions NOTICE.txt
@@ -1,114 +1,98 @@
==============================================================
Jetty Web Container
Copyright 1995-2019 Mort Bay Consulting Pty Ltd.
==============================================================
Notices for Eclipse Jetty
=========================
This content is produced and maintained by the Eclipse Jetty project.

The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
unless otherwise noted.
Project home: https://www.eclipse.org/jetty/

Jetty is dual licensed under both
Trademarks
----------
Eclipse Jetty, and Jetty are trademarks of the Eclipse Foundation.

* The Apache 2.0 License
http://www.apache.org/licenses/LICENSE-2.0.html
Copyright
---------
All contributions are the property of the respective authors or of
entities to which copyright has been assigned by the authors (eg. employer).

and
Declared Project Licenses
-------------------------
This artifacts of this project are made available under the terms of:

* The Eclipse Public 1.0 License
* the Eclipse Public License v. 1.0
http://www.eclipse.org/legal/epl-v10.html
SPDX-License-Identifier: EPL-1.0

Jetty may be distributed under either license.
or

------
Eclipse
* the Apache License, Version 2.0
https://www.apache.org/licenses/LICENSE-2.0.
SPDX-License-Identifier: Apache-2.0

The following artifacts are EPL.
The following dependencies are EPL.
* org.eclipse.jetty.orbit:org.eclipse.jdt.core

The following artifacts are EPL and ASL2.
The following dependencies are EPL and ASL2.
* org.eclipse.jetty.orbit:javax.security.auth.message


The following artifacts are EPL and CDDL 1.0.
The following dependencies are EPL and CDDL 1.0.
* org.eclipse.jetty.orbit:javax.mail.glassfish


------
Oracle

The following artifacts are CDDL + GPLv2 with classpath exception.
The following dependencies are CDDL + GPLv2 with classpath exception.
https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html

* javax.servlet:javax.servlet-api
* javax.annotation:javax.annotation-api
* javax.transaction:javax.transaction-api
* javax.websocket:javax.websocket-api

------
Oracle OpenJDK

If ALPN is used to negotiate HTTP/2 connections, then the following
artifacts may be included in the distribution or downloaded when ALPN
module is selected.

* java.sun.security.ssl

These artifacts replace/modify OpenJDK classes. The modififications
are hosted at github and both modified and original are under GPL v2 with
classpath exceptions.
distribution may be included in the distribution or downloaded when ALPN
module is selected. These artifacts replace/modify OpenJDK classes.
The modifications are hosted at github and both modified and original
are under GPL v2 with classpath exceptions.
http://openjdk.java.net/legal/gplv2+ce.html

* java.sun.security.ssl

------
OW2

The following artifacts are licensed by the OW2 Foundation according to the
The following dependencies are licensed by the OW2 Foundation according to the
terms of http://asm.ow2.org/license.html

org.ow2.asm:asm-commons
org.ow2.asm:asm


------
Apache

The following artifacts are ASL2 licensed.

org.apache.taglibs:taglibs-standard-spec
org.apache.taglibs:taglibs-standard-impl
* org.ow2.asm:asm-commons
* org.ow2.asm:asm

The following dependencies are ASL2 licensed.

------
MortBay
* org.apache.taglibs:taglibs-standard-spec
* org.apache.taglibs:taglibs-standard-impl

The following artifacts are ASL2 licensed. Based on selected classes from
The following dependencies are ASL2 licensed. Based on selected classes from
following Apache Tomcat jars, all ASL2 licensed.

org.mortbay.jasper:apache-jsp
org.apache.tomcat:tomcat-jasper
org.apache.tomcat:tomcat-juli
org.apache.tomcat:tomcat-jsp-api
org.apache.tomcat:tomcat-el-api
org.apache.tomcat:tomcat-jasper-el
org.apache.tomcat:tomcat-api
org.apache.tomcat:tomcat-util-scan
org.apache.tomcat:tomcat-util

org.mortbay.jasper:apache-el
org.apache.tomcat:tomcat-jasper-el
org.apache.tomcat:tomcat-el-api


------
Mortbay
* org.mortbay.jasper:apache-jsp
* org.apache.tomcat:tomcat-jasper
* org.apache.tomcat:tomcat-juli
* org.apache.tomcat:tomcat-jsp-api
* org.apache.tomcat:tomcat-el-api
* org.apache.tomcat:tomcat-jasper-el
* org.apache.tomcat:tomcat-api
* org.apache.tomcat:tomcat-util-scan
* org.apache.tomcat:tomcat-util
* org.mortbay.jasper:apache-el
* org.apache.tomcat:tomcat-jasper-el
* org.apache.tomcat:tomcat-el-api

The following artifacts are CDDL + GPLv2 with classpath exception.

https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html

org.eclipse.jetty.toolchain:jetty-schemas
* org.eclipse.jetty.toolchain:jetty-schemas

------
Assorted
Cryptography
------------
Content may contain encryption software. The country in which you are currently
may have restrictions on the import, possession, and use, and/or re-export to
another country, of encryption software. BEFORE using any encryption software,
please check the country's laws, regulations and policies concerning the import,
possession, or use, and re-export of encryption software, to see if this is
permitted.

The UnixCrypt.java code implements the one way cryptography used by
Unix systems for simple password protection. Copyright 1996 Aki Yoshida,
Expand Down
Expand Up @@ -530,16 +530,29 @@ public Destination getDestination(String scheme, String host, int port)
}

protected HttpDestination destinationFor(String scheme, String host, int port)
{
return resolveDestination(scheme, host, port, null);
}

protected HttpDestination resolveDestination(String scheme, String host, int port, Object tag)
{
Origin origin = createOrigin(scheme, host, port, tag);
return resolveDestination(origin);
}

protected Origin createOrigin(String scheme, String host, int port, Object tag)
{
if (!HttpScheme.HTTP.is(scheme) && !HttpScheme.HTTPS.is(scheme) &&
!HttpScheme.WS.is(scheme) && !HttpScheme.WSS.is(scheme))
throw new IllegalArgumentException("Invalid protocol " + scheme);

scheme = scheme.toLowerCase(Locale.ENGLISH);
host = host.toLowerCase(Locale.ENGLISH);
port = normalizePort(scheme, port);
return new Origin(scheme, host, port, tag);
}

Origin origin = new Origin(scheme, host, port);
protected HttpDestination resolveDestination(Origin origin)
{
return destinations.computeIfAbsent(origin, o ->
{
HttpDestination newDestination = getTransport().newHttpDestination(o);
Expand All @@ -566,7 +579,7 @@ public List<Destination> getDestinations()

protected void send(final HttpRequest request, List<Response.ResponseListener> listeners)
{
HttpDestination destination = destinationFor(request.getScheme(), request.getHost(), request.getPort());
HttpDestination destination = resolveDestination(request.getScheme(), request.getHost(), request.getPort(), request.getTag());
destination.send(request, listeners);
}

Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.jetty.client.api.ContentProvider;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;

Expand Down Expand Up @@ -218,15 +219,8 @@ public void failed(Throwable x)
@Override
public void close()
{
try
{
if (iterator instanceof Closeable)
((Closeable)iterator).close();
}
catch (Throwable x)
{
LOG.ignore(x);
}
if (iterator instanceof Closeable)
IO.close((Closeable)iterator);
}

@Override
Expand Down
Expand Up @@ -94,6 +94,9 @@ public HttpDestination(HttpClient client, Origin origin)
if (isSecure())
connectionFactory = newSslClientConnectionFactory(null, connectionFactory);
}
Object tag = origin.getTag();
if (tag instanceof ClientConnectionFactory.Decorator)
connectionFactory = ((ClientConnectionFactory.Decorator)tag).apply(connectionFactory);
this.connectionFactory = connectionFactory;

String host = HostPort.normalizeHost(getHost());
Expand Down
Expand Up @@ -72,7 +72,7 @@ public URI getURI()
return URI.create(new Origin(scheme, getAddress()).asString());
}

private class HttpProxyClientConnectionFactory implements ClientConnectionFactory
private static class HttpProxyClientConnectionFactory implements ClientConnectionFactory
{
private final ClientConnectionFactory connectionFactory;

Expand Down Expand Up @@ -127,7 +127,7 @@ public org.eclipse.jetty.io.Connection newConnection(EndPoint endPoint, Map<Stri
* tunnel after the TCP connection is succeeded, and needs to notify
* the nested promise when the tunnel is established (or failed).</p>
*/
private class CreateTunnelPromise implements Promise<Connection>
private static class CreateTunnelPromise implements Promise<Connection>
{
private final ClientConnectionFactory connectionFactory;
private final EndPoint endPoint;
Expand Down Expand Up @@ -233,7 +233,7 @@ private void tunnelFailed(EndPoint endPoint, Throwable failure)
}
}

private class ProxyConnection implements Connection
private static class ProxyConnection implements Connection
{
private final Destination destination;
private final Connection connection;
Expand Down Expand Up @@ -272,7 +272,7 @@ public boolean isClosed()
}
}

private class TunnelPromise implements Promise<Connection>
private static class TunnelPromise implements Promise<Connection>
{
private final Request request;
private final Response.CompleteListener listener;
Expand Down
Expand Up @@ -87,6 +87,7 @@ public class HttpRequest implements Request
private List<RequestListener> requestListeners;
private BiFunction<Request, Request, Response.CompleteListener> pushListener;
private Supplier<HttpFields> trailers;
private Object tag;

protected HttpRequest(HttpClient client, HttpConversation conversation, URI uri)
{
Expand Down Expand Up @@ -313,6 +314,19 @@ public Request cookie(HttpCookie cookie)
return this;
}

@Override
public Request tag(Object tag)
{
this.tag = tag;
return this;
}

@Override
public Object getTag()
{
return tag;
}

@Override
public Request attribute(String name, Object value)
{
Expand Down Expand Up @@ -502,21 +516,12 @@ public void onHeaders(Response response)
@Override
public Request onResponseContent(final Response.ContentListener listener)
{
this.responseListeners.add(new Response.DemandedContentListener()
this.responseListeners.add(new Response.ContentListener()
{
@Override
public void onContent(Response response, LongConsumer demand, ByteBuffer content, Callback callback)
public void onContent(Response response, ByteBuffer content)
{
try
{
listener.onContent(response, content);
callback.succeeded();
demand.accept(1);
}
catch (Throwable x)
{
callback.failed(x);
}
listener.onContent(response, content);
}
});
return this;
Expand All @@ -525,16 +530,12 @@ public void onContent(Response response, LongConsumer demand, ByteBuffer content
@Override
public Request onResponseContentAsync(final Response.AsyncContentListener listener)
{
this.responseListeners.add(new Response.DemandedContentListener()
this.responseListeners.add(new Response.AsyncContentListener()
{
@Override
public void onContent(Response response, LongConsumer demand, ByteBuffer content, Callback callback)
public void onContent(Response response, ByteBuffer content, Callback callback)
{
listener.onContent(response, content, Callback.from(() ->
{
callback.succeeded();
demand.accept(1);
}, callback::failed));
listener.onContent(response, content, callback);
}
});
return this;
Expand Down

0 comments on commit 6872c33

Please sign in to comment.