Skip to content

Commit 0865c4b

Browse files
committed
Use same package for Netty 3 and 4 provider, close AsyncHttpClient#887
1 parent 87d295c commit 0865c4b

File tree

219 files changed

+451
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+451
-525
lines changed

api/src/main/java/org/asynchttpclient/DefaultAsyncHttpClient.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public class DefaultAsyncHttpClient implements AsyncHttpClient {
3535
* provider is explicitly specified by the developer.
3636
*/
3737
private static final String[] DEFAULT_PROVIDERS = {//
38-
"org.asynchttpclient.providers.netty4.NettyAsyncHttpProvider",/**/
39-
"org.asynchttpclient.providers.netty3.NettyAsyncHttpProvider",/**/
40-
"org.asynchttpclient.providers.grizzly.GrizzlyAsyncHttpProvider"//
38+
"org.asynchttpclient.providers.netty.NettyAsyncHttpProvider"
4139
};
4240

4341
private final AsyncHttpProvider httpProvider;
@@ -56,13 +54,6 @@ public class DefaultAsyncHttpClient implements AsyncHttpClient {
5654
* Create a new HTTP Asynchronous Client using the default {@link AsyncHttpClientConfig} configuration. The
5755
* default {@link AsyncHttpProvider} that will be used will be based on the classpath configuration.
5856
*
59-
* The default providers will be searched for in this order:
60-
* <ul>
61-
* <li>netty4</li>
62-
* <li>netty3</li>
63-
* <li>grizzly</li>
64-
* </ul>
65-
*
6657
* If none of those providers are found, then the engine will throw an IllegalStateException.
6758
*/
6859
public DefaultAsyncHttpClient() {

api/src/main/java/org/asynchttpclient/RequestBuilderBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ private void computeFinalUri() {
630630
Uri originalUri = request.uri;
631631
if (originalUri == null) {
632632
logger.debug("setUrl hasn't been invoked. Using {}", DEFAULT_REQUEST_URL);
633-
request.uri = DEFAULT_REQUEST_URL;
633+
originalUri = request.uri = DEFAULT_REQUEST_URL;
634634
}
635635

636636
AsyncHttpProviderUtils.validateSupportedScheme(originalUri);

extras/registry/src/test/java/org/asynchttpclient/extras/registry/GrizzlyAsyncHttpClientFactoryTest.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

extras/registry/src/test/java/org/asynchttpclient/extras/registry/Netty4AsyncHttpClientFactoryTest.java

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
import org.asynchttpclient.AsyncHttpClientConfig;
1616
import org.asynchttpclient.AsyncHttpProvider;
1717
import org.asynchttpclient.extras.registry.AbstractAsyncHttpClientFactoryTest;
18-
import org.asynchttpclient.providers.netty3.NettyAsyncHttpProvider;
18+
import org.asynchttpclient.providers.netty.NettyAsyncHttpProvider;
1919
import org.testng.annotations.Test;
2020

2121
@Test
22-
public class Netty3AsyncHttpClientFactoryTest extends AbstractAsyncHttpClientFactoryTest {
22+
public class NettyAsyncHttpClientFactoryTest extends AbstractAsyncHttpClientFactoryTest {
2323

2424
@Override
2525
public AsyncHttpProvider getAsyncHttpProvider(AsyncHttpClientConfig config) {

providers/netty-commons/src/main/java/org/asynchttpclient/providers/netty/commons/future/StackTraceInspector.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,12 @@ private static boolean recoverOnConnectCloseException(Throwable t) {
3333
|| (t.getCause() != null && recoverOnConnectCloseException(t.getCause()));
3434
}
3535

36-
public static boolean recoverOnNetty3DisconnectException(Throwable t) {
36+
public static boolean recoverOnNettyDisconnectException(Throwable t) {
3737
return t instanceof ClosedChannelException
3838
|| exceptionInMethod(t, "io.netty.handler.ssl.SslHandler", "disconnect")
3939
|| (t.getCause() != null && recoverOnConnectCloseException(t.getCause()));
4040
}
4141

42-
public static boolean recoverOnNetty4DisconnectException(Throwable t) {
43-
return t instanceof ClosedChannelException
44-
|| exceptionInMethod(t, "io.netty.handler.ssl.SslHandler", "disconnect")
45-
|| (t.getCause() != null && recoverOnConnectCloseException(t.getCause()));
46-
}
47-
4842
public static boolean recoverOnReadOrWriteException(Throwable t) {
4943

5044
if (t instanceof IOException && "Connection reset by peer".equalsIgnoreCase(t.getMessage()))

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/Callback.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/Callback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3;
14+
package org.asynchttpclient.providers.netty;
1515

16-
import org.asynchttpclient.providers.netty3.future.NettyResponseFuture;
16+
import org.asynchttpclient.providers.netty.future.NettyResponseFuture;
1717

1818
public abstract class Callback {
1919

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/NettyAsyncHttpProvider.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3;
14+
package org.asynchttpclient.providers.netty;
1515

1616
import java.util.concurrent.atomic.AtomicBoolean;
1717

@@ -20,9 +20,9 @@
2020
import org.asynchttpclient.AsyncHttpProvider;
2121
import org.asynchttpclient.ListenableFuture;
2222
import org.asynchttpclient.Request;
23+
import org.asynchttpclient.providers.netty.channel.ChannelManager;
2324
import org.asynchttpclient.providers.netty.commons.channel.pool.ChannelPoolPartitionSelector;
24-
import org.asynchttpclient.providers.netty3.channel.ChannelManager;
25-
import org.asynchttpclient.providers.netty3.request.NettyRequestSender;
25+
import org.asynchttpclient.providers.netty.request.NettyRequestSender;
2626
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
2727
import org.jboss.netty.util.HashedWheelTimer;
2828
import org.jboss.netty.util.Timer;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3;
14+
package org.asynchttpclient.providers.netty;
1515

1616
import java.util.Map;
1717
import java.util.Set;
@@ -20,10 +20,10 @@
2020

2121
import org.asynchttpclient.AsyncHttpProviderConfig;
2222
import org.asynchttpclient.SSLEngineFactory;
23+
import org.asynchttpclient.providers.netty.channel.pool.ChannelPool;
2324
import org.asynchttpclient.providers.netty.commons.handler.ConnectionStrategy;
24-
import org.asynchttpclient.providers.netty3.channel.pool.ChannelPool;
25-
import org.asynchttpclient.providers.netty3.handler.Http1Point1ConnectionStrategy;
26-
import org.asynchttpclient.providers.netty3.ws.NettyWebSocket;
25+
import org.asynchttpclient.providers.netty.handler.Http1Point1ConnectionStrategy;
26+
import org.asynchttpclient.providers.netty.ws.NettyWebSocket;
2727
import org.jboss.netty.channel.Channel;
2828
import org.jboss.netty.channel.ChannelPipeline;
2929
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/channel/ChannelManager.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/channel/ChannelManager.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.channel;
14+
package org.asynchttpclient.providers.netty.channel;
1515

1616
import static org.asynchttpclient.providers.netty.commons.util.HttpUtils.WEBSOCKET;
1717
import static org.asynchttpclient.providers.netty.commons.util.HttpUtils.isSecure;
@@ -35,18 +35,18 @@
3535
import org.asynchttpclient.ConnectionPoolPartitioning;
3636
import org.asynchttpclient.ProxyServer;
3737
import org.asynchttpclient.SSLEngineFactory;
38+
import org.asynchttpclient.providers.netty.Callback;
39+
import org.asynchttpclient.providers.netty.NettyAsyncHttpProviderConfig;
40+
import org.asynchttpclient.providers.netty.channel.pool.ChannelPool;
41+
import org.asynchttpclient.providers.netty.channel.pool.DefaultChannelPool;
42+
import org.asynchttpclient.providers.netty.channel.pool.NoopChannelPool;
3843
import org.asynchttpclient.providers.netty.commons.channel.pool.ChannelPoolPartitionSelector;
39-
import org.asynchttpclient.providers.netty3.Callback;
40-
import org.asynchttpclient.providers.netty3.NettyAsyncHttpProviderConfig;
41-
import org.asynchttpclient.providers.netty3.channel.pool.ChannelPool;
42-
import org.asynchttpclient.providers.netty3.channel.pool.DefaultChannelPool;
43-
import org.asynchttpclient.providers.netty3.channel.pool.NoopChannelPool;
44-
import org.asynchttpclient.providers.netty3.future.NettyResponseFuture;
45-
import org.asynchttpclient.providers.netty3.handler.HttpProtocol;
46-
import org.asynchttpclient.providers.netty3.handler.Processor;
47-
import org.asynchttpclient.providers.netty3.handler.Protocol;
48-
import org.asynchttpclient.providers.netty3.handler.WebSocketProtocol;
49-
import org.asynchttpclient.providers.netty3.request.NettyRequestSender;
44+
import org.asynchttpclient.providers.netty.future.NettyResponseFuture;
45+
import org.asynchttpclient.providers.netty.handler.HttpProtocol;
46+
import org.asynchttpclient.providers.netty.handler.Processor;
47+
import org.asynchttpclient.providers.netty.handler.Protocol;
48+
import org.asynchttpclient.providers.netty.handler.WebSocketProtocol;
49+
import org.asynchttpclient.providers.netty.request.NettyRequestSender;
5050
import org.asynchttpclient.uri.Uri;
5151
import org.jboss.netty.bootstrap.ClientBootstrap;
5252
import org.jboss.netty.channel.Channel;

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/channel/Channels.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/channel/Channels.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.channel;
14+
package org.asynchttpclient.providers.netty.channel;
1515

1616
import org.asynchttpclient.providers.netty.commons.DiscardEvent;
1717
import org.jboss.netty.channel.Channel;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.channel;
14+
package org.asynchttpclient.providers.netty.channel;
1515

1616
import org.jboss.netty.channel.Channel;
1717
import org.jboss.netty.channel.ChannelFuture;

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/channel/SslInitializer.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/channel/SslInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* License for the specific language governing permissions and limitations
1414
* under the License.
1515
*/
16-
package org.asynchttpclient.providers.netty3.channel;
16+
package org.asynchttpclient.providers.netty.channel;
1717

1818
import org.jboss.netty.channel.ChannelHandlerContext;
1919
import org.jboss.netty.channel.ChannelStateEvent;

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/channel/pool/ChannelPool.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/channel/pool/ChannelPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.channel.pool;
14+
package org.asynchttpclient.providers.netty.channel.pool;
1515

1616
import org.asynchttpclient.AsyncHttpProvider;
1717
import org.asynchttpclient.providers.netty.commons.channel.pool.ChannelPoolPartitionSelector;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.channel.pool;
14+
package org.asynchttpclient.providers.netty.channel.pool;
1515

1616
import static org.asynchttpclient.util.DateUtils.millisTime;
1717

@@ -25,9 +25,9 @@
2525
import java.util.concurrent.atomic.AtomicBoolean;
2626

2727
import org.asynchttpclient.AsyncHttpClientConfig;
28+
import org.asynchttpclient.providers.netty.channel.Channels;
2829
import org.asynchttpclient.providers.netty.commons.channel.pool.ChannelPoolPartitionSelector;
29-
import org.asynchttpclient.providers.netty3.channel.Channels;
30-
import org.asynchttpclient.providers.netty3.future.NettyResponseFuture;
30+
import org.asynchttpclient.providers.netty.future.NettyResponseFuture;
3131
import org.jboss.netty.channel.Channel;
3232
import org.jboss.netty.handler.ssl.SslHandler;
3333
import org.jboss.netty.util.Timeout;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.channel.pool;
14+
package org.asynchttpclient.providers.netty.channel.pool;
1515

1616
import org.asynchttpclient.providers.netty.commons.channel.pool.ChannelPoolPartitionSelector;
1717
import org.jboss.netty.channel.Channel;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.future;
14+
package org.asynchttpclient.providers.netty.future;
1515

1616
import static org.asynchttpclient.util.DateUtils.millisTime;
1717

@@ -32,9 +32,9 @@
3232
import org.asynchttpclient.ProxyServer;
3333
import org.asynchttpclient.Request;
3434
import org.asynchttpclient.listenable.AbstractListenableFuture;
35-
import org.asynchttpclient.providers.netty3.channel.Channels;
36-
import org.asynchttpclient.providers.netty3.request.NettyRequest;
37-
import org.asynchttpclient.providers.netty3.request.timeout.TimeoutsHolder;
35+
import org.asynchttpclient.providers.netty.channel.Channels;
36+
import org.asynchttpclient.providers.netty.request.NettyRequest;
37+
import org.asynchttpclient.providers.netty.request.timeout.TimeoutsHolder;
3838
import org.asynchttpclient.uri.Uri;
3939
import org.jboss.netty.channel.Channel;
4040
import org.jboss.netty.handler.codec.http.HttpHeaders;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.handler;
14+
package org.asynchttpclient.providers.netty.handler;
1515

1616
import org.asynchttpclient.providers.netty.commons.handler.ConnectionStrategy;
1717
import org.jboss.netty.handler.codec.http.HttpHeaders;

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/handler/HttpProtocol.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/handler/HttpProtocol.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.handler;
14+
package org.asynchttpclient.providers.netty.handler;
1515

1616
import static org.asynchttpclient.providers.netty.commons.util.HttpUtils.getNTLM;
1717
import static org.asynchttpclient.util.AsyncHttpProviderUtils.getDefaultPort;
@@ -35,14 +35,14 @@
3535
import org.asynchttpclient.RequestBuilder;
3636
import org.asynchttpclient.ntlm.NTLMEngine;
3737
import org.asynchttpclient.ntlm.NTLMEngineException;
38+
import org.asynchttpclient.providers.netty.NettyAsyncHttpProviderConfig;
39+
import org.asynchttpclient.providers.netty.channel.ChannelManager;
3840
import org.asynchttpclient.providers.netty.commons.handler.ConnectionStrategy;
39-
import org.asynchttpclient.providers.netty3.NettyAsyncHttpProviderConfig;
40-
import org.asynchttpclient.providers.netty3.channel.ChannelManager;
41-
import org.asynchttpclient.providers.netty3.future.NettyResponseFuture;
42-
import org.asynchttpclient.providers.netty3.request.NettyRequestSender;
43-
import org.asynchttpclient.providers.netty3.response.NettyResponseBodyPart;
44-
import org.asynchttpclient.providers.netty3.response.NettyResponseHeaders;
45-
import org.asynchttpclient.providers.netty3.response.NettyResponseStatus;
41+
import org.asynchttpclient.providers.netty.future.NettyResponseFuture;
42+
import org.asynchttpclient.providers.netty.request.NettyRequestSender;
43+
import org.asynchttpclient.providers.netty.response.NettyResponseBodyPart;
44+
import org.asynchttpclient.providers.netty.response.NettyResponseHeaders;
45+
import org.asynchttpclient.providers.netty.response.NettyResponseStatus;
4646
import org.asynchttpclient.spnego.SpnegoEngine;
4747
import org.asynchttpclient.uri.Uri;
4848
import org.jboss.netty.channel.Channel;

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/handler/Processor.java renamed to providers/netty3/src/main/java/org/asynchttpclient/providers/netty/handler/Processor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
1313
*/
14-
package org.asynchttpclient.providers.netty3.handler;
14+
package org.asynchttpclient.providers.netty.handler;
1515

1616
import static org.asynchttpclient.util.AsyncHttpProviderUtils.CHANNEL_CLOSED_EXCEPTION;
1717

1818
import java.io.IOException;
1919
import java.nio.channels.ClosedChannelException;
2020

2121
import org.asynchttpclient.AsyncHttpClientConfig;
22+
import org.asynchttpclient.providers.netty.Callback;
23+
import org.asynchttpclient.providers.netty.channel.ChannelManager;
24+
import org.asynchttpclient.providers.netty.channel.Channels;
2225
import org.asynchttpclient.providers.netty.commons.DiscardEvent;
2326
import org.asynchttpclient.providers.netty.commons.future.StackTraceInspector;
24-
import org.asynchttpclient.providers.netty3.Callback;
25-
import org.asynchttpclient.providers.netty3.channel.ChannelManager;
26-
import org.asynchttpclient.providers.netty3.channel.Channels;
27-
import org.asynchttpclient.providers.netty3.future.NettyResponseFuture;
28-
import org.asynchttpclient.providers.netty3.request.NettyRequestSender;
27+
import org.asynchttpclient.providers.netty.future.NettyResponseFuture;
28+
import org.asynchttpclient.providers.netty.request.NettyRequestSender;
2929
import org.jboss.netty.channel.Channel;
3030
import org.jboss.netty.channel.ChannelHandlerContext;
3131
import org.jboss.netty.channel.ChannelStateEvent;

0 commit comments

Comments
 (0)