Renamed "Empty" inner classes to "Adapter" to comply with the rest of
the codebase.
This commit is contained in:
parent
3be5670448
commit
4663fa4992
|
@ -25,7 +25,6 @@ import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javax.servlet.AsyncContext;
|
import javax.servlet.AsyncContext;
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -163,7 +162,7 @@ public class AsyncRestServlet extends AbstractRestServlet
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private abstract class AsyncRestRequest extends Response.Listener.Empty
|
private abstract class AsyncRestRequest extends Response.Listener.Adapter
|
||||||
{
|
{
|
||||||
final Utf8StringBuilder _content = new Utf8StringBuilder();
|
final Utf8StringBuilder _content = new Utf8StringBuilder();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.jetty.client.api.Request;
|
||||||
import org.eclipse.jetty.client.api.Response;
|
import org.eclipse.jetty.client.api.Response;
|
||||||
import org.eclipse.jetty.client.api.Result;
|
import org.eclipse.jetty.client.api.Result;
|
||||||
|
|
||||||
public class RedirectProtocolHandler extends Response.Listener.Empty implements ProtocolHandler
|
public class RedirectProtocolHandler extends Response.Listener.Adapter implements ProtocolHandler
|
||||||
{
|
{
|
||||||
private final HttpRedirector redirector;
|
private final HttpRedirector redirector;
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,7 @@ public interface Request
|
||||||
/**
|
/**
|
||||||
* An empty implementation of {@link Listener}
|
* An empty implementation of {@link Listener}
|
||||||
*/
|
*/
|
||||||
public static class Empty implements Listener
|
public static class Adapter implements Listener
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onQueued(Request request)
|
public void onQueued(Request request)
|
||||||
|
|
|
@ -202,7 +202,7 @@ public interface Response
|
||||||
/**
|
/**
|
||||||
* An empty implementation of {@link Listener}
|
* An empty implementation of {@link Listener}
|
||||||
*/
|
*/
|
||||||
public static class Empty implements Listener
|
public static class Adapter implements Listener
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Response response)
|
public void onBegin(Response response)
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.jetty.http.HttpHeader;
|
||||||
* <p>The content may be retrieved from {@link #onSuccess(Response)} or {@link #onComplete(Result)}
|
* <p>The content may be retrieved from {@link #onSuccess(Response)} or {@link #onComplete(Result)}
|
||||||
* via {@link #getContent()} or {@link #getContentAsString()}.</p>
|
* via {@link #getContent()} or {@link #getContentAsString()}.</p>
|
||||||
*/
|
*/
|
||||||
public abstract class BufferingResponseListener extends Response.Listener.Empty
|
public abstract class BufferingResponseListener extends Listener.Adapter
|
||||||
{
|
{
|
||||||
private final int maxLength;
|
private final int maxLength;
|
||||||
private volatile byte[] buffer = new byte[0];
|
private volatile byte[] buffer = new byte[0];
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
package org.eclipse.jetty.client.util;
|
package org.eclipse.jetty.client.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -72,7 +71,7 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* If the consumer is slower than the producer, then the producer will block
|
* If the consumer is slower than the producer, then the producer will block
|
||||||
* until the client consumes.
|
* until the client consumes.
|
||||||
*/
|
*/
|
||||||
public class InputStreamResponseListener extends Response.Listener.Empty
|
public class InputStreamResponseListener extends Listener.Adapter
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(InputStreamResponseListener.class);
|
private static final Logger LOG = Log.getLogger(InputStreamResponseListener.class);
|
||||||
private static final byte[] EOF = new byte[0];
|
private static final byte[] EOF = new byte[0];
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class ExternalSiteTest
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Response response, Throwable failure)
|
public void onFailure(Response response, Throwable failure)
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
||||||
AuthenticationStore authenticationStore = client.getAuthenticationStore();
|
AuthenticationStore authenticationStore = client.getAuthenticationStore();
|
||||||
|
|
||||||
final AtomicReference<CountDownLatch> requests = new AtomicReference<>(new CountDownLatch(1));
|
final AtomicReference<CountDownLatch> requests = new AtomicReference<>(new CountDownLatch(1));
|
||||||
Request.Listener.Empty requestListener = new Request.Listener.Empty()
|
Request.Listener.Adapter requestListener = new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
@ -137,7 +137,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
||||||
authenticationStore.addAuthentication(authentication);
|
authenticationStore.addAuthentication(authentication);
|
||||||
|
|
||||||
requests.set(new CountDownLatch(2));
|
requests.set(new CountDownLatch(2));
|
||||||
requestListener = new Request.Listener.Empty()
|
requestListener = new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
@ -156,7 +156,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
||||||
client.getRequestListeners().remove(requestListener);
|
client.getRequestListeners().remove(requestListener);
|
||||||
|
|
||||||
requests.set(new CountDownLatch(1));
|
requests.set(new CountDownLatch(1));
|
||||||
requestListener = new Request.Listener.Empty()
|
requestListener = new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
@ -196,7 +196,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
||||||
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, "basic", "basic"));
|
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||||
|
|
||||||
final CountDownLatch requests = new CountDownLatch(3);
|
final CountDownLatch requests = new CountDownLatch(3);
|
||||||
Request.Listener.Empty requestListener = new Request.Listener.Empty()
|
Request.Listener.Adapter requestListener = new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
@ -235,7 +235,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
||||||
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, "basic", "basic"));
|
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, "basic", "basic"));
|
||||||
|
|
||||||
final CountDownLatch requests = new CountDownLatch(3);
|
final CountDownLatch requests = new CountDownLatch(3);
|
||||||
Request.Listener.Empty requestListener = new Request.Listener.Empty()
|
Request.Listener.Adapter requestListener = new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
@ -262,7 +262,7 @@ public class HttpClientAuthenticationTest extends AbstractHttpClientServerTest
|
||||||
startBasic(new EmptyServerHandler());
|
startBasic(new EmptyServerHandler());
|
||||||
|
|
||||||
final AtomicReference<CountDownLatch> requests = new AtomicReference<>(new CountDownLatch(2));
|
final AtomicReference<CountDownLatch> requests = new AtomicReference<>(new CountDownLatch(2));
|
||||||
Request.Listener.Empty requestListener = new Request.Listener.Empty()
|
Request.Listener.Adapter requestListener = new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
|
|
@ -407,7 +407,7 @@ public class HttpClientContinueTest extends AbstractHttpClientServerTest
|
||||||
public Response.Listener getResponseListener()
|
public Response.Listener getResponseListener()
|
||||||
{
|
{
|
||||||
final Response.Listener listener = super.getResponseListener();
|
final Response.Listener listener = super.getResponseListener();
|
||||||
return new Response.Listener.Empty()
|
return new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Response response)
|
public void onBegin(Response response)
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class HttpClientLoadTest extends AbstractHttpClientServerTest
|
||||||
}
|
}
|
||||||
|
|
||||||
final CountDownLatch requestLatch = new CountDownLatch(1);
|
final CountDownLatch requestLatch = new CountDownLatch(1);
|
||||||
request.send(new Response.Listener.Empty()
|
request.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
private final AtomicInteger contentLength = new AtomicInteger();
|
private final AtomicInteger contentLength = new AtomicInteger();
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class HttpClientProxyTest extends AbstractHttpClientServerTest
|
||||||
URI uri = URI.create(scheme + "://" + proxyHost + ":" + proxyPort);
|
URI uri = URI.create(scheme + "://" + proxyHost + ":" + proxyPort);
|
||||||
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, user, password));
|
client.getAuthenticationStore().addAuthentication(new BasicAuthentication(uri, realm, user, password));
|
||||||
final AtomicInteger requests = new AtomicInteger();
|
final AtomicInteger requests = new AtomicInteger();
|
||||||
client.getRequestListeners().add(new Request.Listener.Empty()
|
client.getRequestListeners().add(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class HttpClientRedirectTest extends AbstractHttpClientServerTest
|
||||||
private void testMethodRedirect(final HttpMethod requestMethod, final HttpMethod redirectMethod, int redirectCode) throws Exception
|
private void testMethodRedirect(final HttpMethod requestMethod, final HttpMethod redirectMethod, int redirectCode) throws Exception
|
||||||
{
|
{
|
||||||
final AtomicInteger passes = new AtomicInteger();
|
final AtomicInteger passes = new AtomicInteger();
|
||||||
client.getRequestListeners().add(new org.eclipse.jetty.client.api.Request.Listener.Empty()
|
client.getRequestListeners().add(new org.eclipse.jetty.client.api.Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(org.eclipse.jetty.client.api.Request request)
|
public void onBegin(org.eclipse.jetty.client.api.Request request)
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class HttpClientSynchronizationTest extends AbstractHttpClientServerTest
|
||||||
|
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
request.send(new Response.Listener.Empty()
|
request.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Response response, Throwable failure)
|
public void onFailure(Response response, Throwable failure)
|
||||||
|
@ -88,7 +88,7 @@ public class HttpClientSynchronizationTest extends AbstractHttpClientServerTest
|
||||||
|
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
request.send(new Response.Listener.Empty()
|
request.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
|
|
@ -402,7 +402,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response response)
|
public void onSuccess(Response response)
|
||||||
|
@ -422,7 +422,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response response)
|
public void onSuccess(Response response)
|
||||||
|
@ -449,7 +449,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
client.newRequest("localhost", connector.getLocalPort())
|
client.newRequest("localhost", connector.getLocalPort())
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.path("/one")
|
.path("/one")
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Request request)
|
public void onBegin(Request request)
|
||||||
|
@ -530,7 +530,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response response)
|
public void onSuccess(Response response)
|
||||||
|
@ -609,7 +609,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
@ -640,7 +640,7 @@ public class HttpClientTest extends AbstractHttpClientServerTest
|
||||||
destination.getHttpConnectionPool().getActiveConnections().peek().close();
|
destination.getHttpConnectionPool().getActiveConnections().peek().close();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
headersLatch.countDown();
|
headersLatch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response response)
|
public void onSuccess(Response response)
|
||||||
|
@ -139,7 +139,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
|
|
||||||
final CountDownLatch beginLatch = new CountDownLatch(1);
|
final CountDownLatch beginLatch = new CountDownLatch(1);
|
||||||
final CountDownLatch failureLatch = new CountDownLatch(2);
|
final CountDownLatch failureLatch = new CountDownLatch(2);
|
||||||
client.newRequest(host, port).scheme(scheme).listener(new Request.Listener.Empty()
|
client.newRequest(host, port).scheme(scheme).listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Request request)
|
public void onBegin(Request request)
|
||||||
|
@ -153,7 +153,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
{
|
{
|
||||||
failureLatch.countDown();
|
failureLatch.countDown();
|
||||||
}
|
}
|
||||||
}).send(new Response.Listener.Empty()
|
}).send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
@ -191,7 +191,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
final CountDownLatch successLatch = new CountDownLatch(3);
|
final CountDownLatch successLatch = new CountDownLatch(3);
|
||||||
client.newRequest(host, port)
|
client.newRequest(host, port)
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Request request)
|
public void onBegin(Request request)
|
||||||
|
@ -206,7 +206,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
successLatch.countDown();
|
successLatch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response response)
|
public void onSuccess(Response response)
|
||||||
|
@ -252,7 +252,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
final CountDownLatch successLatch = new CountDownLatch(3);
|
final CountDownLatch successLatch = new CountDownLatch(3);
|
||||||
client.newRequest(host, port)
|
client.newRequest(host, port)
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Request request)
|
public void onBegin(Request request)
|
||||||
|
@ -280,7 +280,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
successLatch.countDown();
|
successLatch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Response response)
|
public void onSuccess(Response response)
|
||||||
|
@ -334,7 +334,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
failureLatch.countDown();
|
failureLatch.countDown();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
@ -377,7 +377,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
client.newRequest(host, port)
|
client.newRequest(host, port)
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
@ -432,7 +432,7 @@ public class HttpConnectionLifecycleTest extends AbstractHttpClientServerTest
|
||||||
client.newRequest(host, port)
|
client.newRequest(host, port)
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.content(new ByteBufferContentProvider(buffer))
|
.content(new ByteBufferContentProvider(buffer))
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||||
{
|
{
|
||||||
client.newRequest("localhost", connector.getLocalPort())
|
client.newRequest("localhost", connector.getLocalPort())
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onQueued(Request request)
|
public void onQueued(Request request)
|
||||||
|
@ -97,7 +97,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||||
{
|
{
|
||||||
client.newRequest("localhost", connector.getLocalPort())
|
client.newRequest("localhost", connector.getLocalPort())
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Request request)
|
public void onBegin(Request request)
|
||||||
|
@ -137,7 +137,7 @@ public class HttpRequestAbortTest extends AbstractHttpClientServerTest
|
||||||
{
|
{
|
||||||
client.newRequest("localhost", connector.getLocalPort())
|
client.newRequest("localhost", connector.getLocalPort())
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onHeaders(Request request)
|
public void onHeaders(Request request)
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class HttpSenderTest
|
||||||
// Request request = client.newRequest(URI.create("http://localhost/"));
|
// Request request = client.newRequest(URI.create("http://localhost/"));
|
||||||
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
||||||
// final CountDownLatch successLatch = new CountDownLatch(1);
|
// final CountDownLatch successLatch = new CountDownLatch(1);
|
||||||
// request.listener(new Request.Listener.Empty()
|
// request.listener(new Request.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onHeaders(Request request)
|
// public void onHeaders(Request request)
|
||||||
|
@ -108,7 +108,7 @@ public class HttpSenderTest
|
||||||
// HttpConnection connection = new HttpConnection(client, endPoint, destination);
|
// HttpConnection connection = new HttpConnection(client, endPoint, destination);
|
||||||
// Request request = client.newRequest(URI.create("http://localhost/"));
|
// Request request = client.newRequest(URI.create("http://localhost/"));
|
||||||
// final CountDownLatch failureLatch = new CountDownLatch(2);
|
// final CountDownLatch failureLatch = new CountDownLatch(2);
|
||||||
// request.listener(new Request.Listener.Empty()
|
// request.listener(new Request.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onFailure(Request request, Throwable x)
|
// public void onFailure(Request request, Throwable x)
|
||||||
|
@ -116,7 +116,7 @@ public class HttpSenderTest
|
||||||
// failureLatch.countDown();
|
// failureLatch.countDown();
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// connection.send(request, new Response.Listener.Empty()
|
// connection.send(request, new Response.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onComplete(Result result)
|
// public void onComplete(Result result)
|
||||||
|
@ -137,7 +137,7 @@ public class HttpSenderTest
|
||||||
// HttpConnection connection = new HttpConnection(client, endPoint, destination);
|
// HttpConnection connection = new HttpConnection(client, endPoint, destination);
|
||||||
// Request request = client.newRequest(URI.create("http://localhost/"));
|
// Request request = client.newRequest(URI.create("http://localhost/"));
|
||||||
// final CountDownLatch failureLatch = new CountDownLatch(2);
|
// final CountDownLatch failureLatch = new CountDownLatch(2);
|
||||||
// request.listener(new Request.Listener.Empty()
|
// request.listener(new Request.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onFailure(Request request, Throwable x)
|
// public void onFailure(Request request, Throwable x)
|
||||||
|
@ -145,7 +145,7 @@ public class HttpSenderTest
|
||||||
// failureLatch.countDown();
|
// failureLatch.countDown();
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// connection.send(request, new Response.Listener.Empty()
|
// connection.send(request, new Response.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onComplete(Result result)
|
// public void onComplete(Result result)
|
||||||
|
@ -175,7 +175,7 @@ public class HttpSenderTest
|
||||||
// request.content(new ByteBufferContentProvider(ByteBuffer.wrap(content.getBytes("UTF-8"))));
|
// request.content(new ByteBufferContentProvider(ByteBuffer.wrap(content.getBytes("UTF-8"))));
|
||||||
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
||||||
// final CountDownLatch successLatch = new CountDownLatch(1);
|
// final CountDownLatch successLatch = new CountDownLatch(1);
|
||||||
// request.listener(new Request.Listener.Empty()
|
// request.listener(new Request.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onHeaders(Request request)
|
// public void onHeaders(Request request)
|
||||||
|
@ -210,7 +210,7 @@ public class HttpSenderTest
|
||||||
// request.content(new ByteBufferContentProvider(ByteBuffer.wrap(content1.getBytes("UTF-8")), ByteBuffer.wrap(content2.getBytes("UTF-8"))));
|
// request.content(new ByteBufferContentProvider(ByteBuffer.wrap(content1.getBytes("UTF-8")), ByteBuffer.wrap(content2.getBytes("UTF-8"))));
|
||||||
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
||||||
// final CountDownLatch successLatch = new CountDownLatch(1);
|
// final CountDownLatch successLatch = new CountDownLatch(1);
|
||||||
// request.listener(new Request.Listener.Empty()
|
// request.listener(new Request.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onHeaders(Request request)
|
// public void onHeaders(Request request)
|
||||||
|
@ -252,7 +252,7 @@ public class HttpSenderTest
|
||||||
// });
|
// });
|
||||||
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
// final CountDownLatch headersLatch = new CountDownLatch(1);
|
||||||
// final CountDownLatch successLatch = new CountDownLatch(1);
|
// final CountDownLatch successLatch = new CountDownLatch(1);
|
||||||
// request.listener(new Request.Listener.Empty()
|
// request.listener(new Request.Listener.Adapter()
|
||||||
// {
|
// {
|
||||||
// @Override
|
// @Override
|
||||||
// public void onHeaders(Request request)
|
// public void onHeaders(Request request)
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class Usage
|
||||||
|
|
||||||
Response response = client.newRequest("localhost", 8080)
|
Response response = client.newRequest("localhost", 8080)
|
||||||
// Add a request listener
|
// Add a request listener
|
||||||
.listener(new Request.Listener.Empty()
|
.listener(new Request.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Request request)
|
public void onSuccess(Request request)
|
||||||
|
@ -319,7 +319,7 @@ public class Usage
|
||||||
DeferredContentProvider async = new DeferredContentProvider(ByteBuffer.wrap(new byte[]{0, 1, 2}));
|
DeferredContentProvider async = new DeferredContentProvider(ByteBuffer.wrap(new byte[]{0, 1, 2}));
|
||||||
client.newRequest("localhost", 8080)
|
client.newRequest("localhost", 8080)
|
||||||
.content(async)
|
.content(async)
|
||||||
.send(new Response.Listener.Empty()
|
.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onBegin(Response response)
|
public void onBegin(Response response)
|
||||||
|
|
|
@ -71,7 +71,7 @@ public interface Connection extends AutoCloseable
|
||||||
|
|
||||||
public void onClosed(Connection connection);
|
public void onClosed(Connection connection);
|
||||||
|
|
||||||
public static class Empty implements Listener
|
public static class Adapter implements Listener
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onOpened(Connection connection)
|
public void onOpened(Connection connection)
|
||||||
|
|
|
@ -79,7 +79,7 @@ public interface NetworkTrafficListener
|
||||||
/**
|
/**
|
||||||
* <p>A commodity class that implements {@link NetworkTrafficListener} with empty methods.</p>
|
* <p>A commodity class that implements {@link NetworkTrafficListener} with empty methods.</p>
|
||||||
*/
|
*/
|
||||||
public static class Empty implements NetworkTrafficListener
|
public static class Adapter implements NetworkTrafficListener
|
||||||
{
|
{
|
||||||
public void opened(Socket socket)
|
public void opened(Socket socket)
|
||||||
{
|
{
|
||||||
|
|
|
@ -629,7 +629,7 @@ public class ProxyServlet extends HttpServlet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProxyResponseListener extends Response.Listener.Empty
|
private class ProxyResponseListener extends Response.Listener.Adapter
|
||||||
{
|
{
|
||||||
private final HttpServletRequest request;
|
private final HttpServletRequest request;
|
||||||
private final HttpServletResponse response;
|
private final HttpServletResponse response;
|
||||||
|
|
|
@ -27,7 +27,6 @@ import java.net.Socket;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -41,7 +40,6 @@ import org.eclipse.jetty.toolchain.test.http.SimpleHttpResponse;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
import org.eclipse.jetty.util.resource.Resource;
|
import org.eclipse.jetty.util.resource.Resource;
|
||||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||||
import org.hamcrest.Matchers;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -69,7 +67,7 @@ public class ConnectionOpenCloseTest extends AbstractHttpTest
|
||||||
final AtomicInteger callbacks = new AtomicInteger();
|
final AtomicInteger callbacks = new AtomicInteger();
|
||||||
final CountDownLatch openLatch = new CountDownLatch(1);
|
final CountDownLatch openLatch = new CountDownLatch(1);
|
||||||
final CountDownLatch closeLatch = new CountDownLatch(1);
|
final CountDownLatch closeLatch = new CountDownLatch(1);
|
||||||
connector.addBean(new Connection.Listener.Empty()
|
connector.addBean(new Connection.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onOpened(Connection connection)
|
public void onOpened(Connection connection)
|
||||||
|
@ -119,7 +117,7 @@ public class ConnectionOpenCloseTest extends AbstractHttpTest
|
||||||
final AtomicInteger callbacks = new AtomicInteger();
|
final AtomicInteger callbacks = new AtomicInteger();
|
||||||
final CountDownLatch openLatch = new CountDownLatch(1);
|
final CountDownLatch openLatch = new CountDownLatch(1);
|
||||||
final CountDownLatch closeLatch = new CountDownLatch(1);
|
final CountDownLatch closeLatch = new CountDownLatch(1);
|
||||||
connector.addBean(new Connection.Listener.Empty()
|
connector.addBean(new Connection.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onOpened(Connection connection)
|
public void onOpened(Connection connection)
|
||||||
|
@ -190,7 +188,7 @@ public class ConnectionOpenCloseTest extends AbstractHttpTest
|
||||||
final AtomicInteger callbacks = new AtomicInteger();
|
final AtomicInteger callbacks = new AtomicInteger();
|
||||||
final CountDownLatch openLatch = new CountDownLatch(1);
|
final CountDownLatch openLatch = new CountDownLatch(1);
|
||||||
final CountDownLatch closeLatch = new CountDownLatch(1);
|
final CountDownLatch closeLatch = new CountDownLatch(1);
|
||||||
connector.addBean(new Connection.Listener.Empty()
|
connector.addBean(new Connection.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onOpened(Connection connection)
|
public void onOpened(Connection connection)
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.server;
|
package org.eclipse.jetty.server;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsString;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -30,6 +26,10 @@ import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class LocalConnectorTest
|
public class LocalConnectorTest
|
||||||
{
|
{
|
||||||
private Server _server;
|
private Server _server;
|
||||||
|
@ -59,7 +59,7 @@ public class LocalConnectorTest
|
||||||
{
|
{
|
||||||
final CountDownLatch openLatch = new CountDownLatch(1);
|
final CountDownLatch openLatch = new CountDownLatch(1);
|
||||||
final CountDownLatch closeLatch = new CountDownLatch(1);
|
final CountDownLatch closeLatch = new CountDownLatch(1);
|
||||||
_connector.addBean(new Connection.Listener.Empty()
|
_connector.addBean(new Connection.Listener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onOpened(Connection connection)
|
public void onOpened(Connection connection)
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.server;
|
package org.eclipse.jetty.server;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -30,7 +27,6 @@ import java.nio.ByteBuffer;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -45,6 +41,9 @@ import org.junit.After;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
public class NetworkTrafficListenerTest
|
public class NetworkTrafficListenerTest
|
||||||
{
|
{
|
||||||
|
@ -82,7 +81,7 @@ public class NetworkTrafficListenerTest
|
||||||
|
|
||||||
final CountDownLatch openedLatch = new CountDownLatch(1);
|
final CountDownLatch openedLatch = new CountDownLatch(1);
|
||||||
final CountDownLatch closedLatch = new CountDownLatch(1);
|
final CountDownLatch closedLatch = new CountDownLatch(1);
|
||||||
connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty()
|
connector.addNetworkTrafficListener(new NetworkTrafficListener.Adapter()
|
||||||
{
|
{
|
||||||
public volatile Socket socket;
|
public volatile Socket socket;
|
||||||
|
|
||||||
|
@ -125,7 +124,7 @@ public class NetworkTrafficListenerTest
|
||||||
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
||||||
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
||||||
final CountDownLatch outgoingLatch = new CountDownLatch(1);
|
final CountDownLatch outgoingLatch = new CountDownLatch(1);
|
||||||
connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty()
|
connector.addNetworkTrafficListener(new NetworkTrafficListener.Adapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void incoming(Socket socket, ByteBuffer bytes)
|
public void incoming(Socket socket, ByteBuffer bytes)
|
||||||
|
@ -190,7 +189,7 @@ public class NetworkTrafficListenerTest
|
||||||
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
||||||
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
||||||
final CountDownLatch outgoingLatch = new CountDownLatch(2);
|
final CountDownLatch outgoingLatch = new CountDownLatch(2);
|
||||||
connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty()
|
connector.addNetworkTrafficListener(new NetworkTrafficListener.Adapter()
|
||||||
{
|
{
|
||||||
public void incoming(Socket socket, ByteBuffer bytes)
|
public void incoming(Socket socket, ByteBuffer bytes)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +256,7 @@ public class NetworkTrafficListenerTest
|
||||||
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
||||||
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
||||||
final CountDownLatch outgoingLatch = new CountDownLatch(4);
|
final CountDownLatch outgoingLatch = new CountDownLatch(4);
|
||||||
connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty()
|
connector.addNetworkTrafficListener(new NetworkTrafficListener.Adapter()
|
||||||
{
|
{
|
||||||
public void incoming(Socket socket, ByteBuffer bytes)
|
public void incoming(Socket socket, ByteBuffer bytes)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +322,7 @@ public class NetworkTrafficListenerTest
|
||||||
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
final CountDownLatch incomingLatch = new CountDownLatch(1);
|
||||||
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
||||||
final CountDownLatch outgoingLatch = new CountDownLatch(1);
|
final CountDownLatch outgoingLatch = new CountDownLatch(1);
|
||||||
connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty()
|
connector.addNetworkTrafficListener(new NetworkTrafficListener.Adapter()
|
||||||
{
|
{
|
||||||
public void incoming(Socket socket, ByteBuffer bytes)
|
public void incoming(Socket socket, ByteBuffer bytes)
|
||||||
{
|
{
|
||||||
|
@ -396,7 +395,7 @@ public class NetworkTrafficListenerTest
|
||||||
final AtomicReference<String> incomingData = new AtomicReference<String>("");
|
final AtomicReference<String> incomingData = new AtomicReference<String>("");
|
||||||
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
final AtomicReference<String> outgoingData = new AtomicReference<String>("");
|
||||||
final CountDownLatch outgoingLatch = new CountDownLatch(1);
|
final CountDownLatch outgoingLatch = new CountDownLatch(1);
|
||||||
connector.addNetworkTrafficListener(new NetworkTrafficListener.Empty()
|
connector.addNetworkTrafficListener(new NetworkTrafficListener.Adapter()
|
||||||
{
|
{
|
||||||
public void incoming(Socket socket, ByteBuffer bytes)
|
public void incoming(Socket socket, ByteBuffer bytes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class HTTPProxyEngine extends ProxyEngine
|
||||||
|
|
||||||
private void sendRequest(final Stream clientStream, Request request)
|
private void sendRequest(final Stream clientStream, Request request)
|
||||||
{
|
{
|
||||||
request.send(new Response.Listener.Empty()
|
request.send(new Response.Listener.Adapter()
|
||||||
{
|
{
|
||||||
private volatile boolean committed;
|
private volatile boolean committed;
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ public class PushStrategyBenchmarkTest extends AbstractHTTPSPDYTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestListener extends Response.Listener.Empty
|
private class TestListener extends Response.Listener.Adapter
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Result result)
|
public void onComplete(Result result)
|
||||||
|
|
Loading…
Reference in New Issue