|
15 | 15 | */
|
16 | 16 | package com.ning.http.client.providers.netty;
|
17 | 17 |
|
18 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.BOSS_EXECUTOR_SERVICE; |
19 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.DISABLE_NESTED_REQUEST; |
20 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.EXECUTE_ASYNC_CONNECT; |
21 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTPS_CLIENT_CODEC_MAX_CHUNK_SIZE; |
22 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTPS_CLIENT_CODEC_MAX_HEADER_SIZE; |
23 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTPS_CLIENT_CODEC_MAX_INITIAL_LINE_LENGTH; |
24 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTP_CLIENT_CODEC_MAX_CHUNK_SIZE; |
25 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTP_CLIENT_CODEC_MAX_HEADER_SIZE; |
26 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTP_CLIENT_CODEC_MAX_INITIAL_LINE_LENGTH; |
27 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.REUSE_ADDRESS; |
28 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.SOCKET_CHANNEL_FACTORY; |
29 |
| -import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.USE_BLOCKING_IO; |
30 |
| -import static com.ning.http.util.AsyncHttpProviderUtils.DEFAULT_CHARSET; |
31 |
| -import static com.ning.http.util.MiscUtil.isNonEmpty; |
32 |
| -import static org.jboss.netty.channel.Channels.pipeline; |
33 |
| - |
34 |
| -import java.io.File; |
35 |
| -import java.io.FileInputStream; |
36 |
| -import java.io.IOException; |
37 |
| -import java.io.RandomAccessFile; |
38 |
| -import java.net.ConnectException; |
39 |
| -import java.net.InetSocketAddress; |
40 |
| -import java.net.MalformedURLException; |
41 |
| -import java.net.URI; |
42 |
| -import java.nio.channels.ClosedChannelException; |
43 |
| -import java.nio.channels.FileChannel; |
44 |
| -import java.nio.channels.WritableByteChannel; |
45 |
| -import java.nio.charset.Charset; |
46 |
| -import java.security.GeneralSecurityException; |
47 |
| -import java.security.NoSuchAlgorithmException; |
48 |
| -import java.util.ArrayList; |
49 |
| -import java.util.List; |
50 |
| -import java.util.Locale; |
51 |
| -import java.util.Map.Entry; |
52 |
| -import java.util.concurrent.Callable; |
53 |
| -import java.util.concurrent.ExecutorService; |
54 |
| -import java.util.concurrent.Executors; |
55 |
| -import java.util.concurrent.RejectedExecutionException; |
56 |
| -import java.util.concurrent.Semaphore; |
57 |
| -import java.util.concurrent.TimeUnit; |
58 |
| -import java.util.concurrent.atomic.AtomicBoolean; |
59 |
| - |
60 |
| -import javax.net.ssl.SSLEngine; |
61 |
| - |
62 |
| -import org.jboss.netty.bootstrap.ClientBootstrap; |
63 |
| -import org.jboss.netty.buffer.ChannelBuffer; |
64 |
| -import org.jboss.netty.buffer.ChannelBufferOutputStream; |
65 |
| -import org.jboss.netty.buffer.ChannelBuffers; |
66 |
| -import org.jboss.netty.channel.Channel; |
67 |
| -import org.jboss.netty.channel.ChannelFuture; |
68 |
| -import org.jboss.netty.channel.ChannelFutureProgressListener; |
69 |
| -import org.jboss.netty.channel.ChannelHandlerContext; |
70 |
| -import org.jboss.netty.channel.ChannelPipeline; |
71 |
| -import org.jboss.netty.channel.ChannelPipelineFactory; |
72 |
| -import org.jboss.netty.channel.ChannelStateEvent; |
73 |
| -import org.jboss.netty.channel.DefaultChannelFuture; |
74 |
| -import org.jboss.netty.channel.ExceptionEvent; |
75 |
| -import org.jboss.netty.channel.FileRegion; |
76 |
| -import org.jboss.netty.channel.MessageEvent; |
77 |
| -import org.jboss.netty.channel.SimpleChannelUpstreamHandler; |
78 |
| -import org.jboss.netty.channel.group.ChannelGroup; |
79 |
| -import org.jboss.netty.channel.socket.ClientSocketChannelFactory; |
80 |
| -import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; |
81 |
| -import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; |
82 |
| -import org.jboss.netty.handler.codec.PrematureChannelClosureException; |
83 |
| -import org.jboss.netty.handler.codec.http.DefaultHttpChunkTrailer; |
84 |
| -import org.jboss.netty.handler.codec.http.DefaultHttpRequest; |
85 |
| -import org.jboss.netty.handler.codec.http.HttpChunk; |
86 |
| -import org.jboss.netty.handler.codec.http.HttpChunkTrailer; |
87 |
| -import org.jboss.netty.handler.codec.http.HttpClientCodec; |
88 |
| -import org.jboss.netty.handler.codec.http.HttpContentDecompressor; |
89 |
| -import org.jboss.netty.handler.codec.http.HttpHeaders; |
90 |
| -import org.jboss.netty.handler.codec.http.HttpMethod; |
91 |
| -import org.jboss.netty.handler.codec.http.HttpRequest; |
92 |
| -import org.jboss.netty.handler.codec.http.HttpResponse; |
93 |
| -import org.jboss.netty.handler.codec.http.HttpVersion; |
94 |
| -import org.jboss.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; |
95 |
| -import org.jboss.netty.handler.codec.http.websocketx.CloseWebSocketFrame; |
96 |
| -import org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame; |
97 |
| -import org.jboss.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder; |
98 |
| -import org.jboss.netty.handler.codec.http.websocketx.WebSocket08FrameEncoder; |
99 |
| -import org.jboss.netty.handler.codec.http.websocketx.WebSocketFrame; |
100 |
| -import org.jboss.netty.handler.ssl.SslHandler; |
101 |
| -import org.jboss.netty.handler.stream.ChunkedFile; |
102 |
| -import org.jboss.netty.handler.stream.ChunkedWriteHandler; |
103 |
| -import org.jboss.netty.util.HashedWheelTimer; |
104 |
| -import org.jboss.netty.util.Timeout; |
105 |
| -import org.jboss.netty.util.TimerTask; |
106 |
| -import org.slf4j.Logger; |
107 |
| -import org.slf4j.LoggerFactory; |
108 |
| - |
109 | 18 | import com.ning.http.client.AsyncHandler;
|
110 | 19 | import com.ning.http.client.AsyncHandler.STATE;
|
111 | 20 | import com.ning.http.client.AsyncHandlerExtensions;
|
|
153 | 62 | import com.ning.http.util.UTF8UrlEncoder;
|
154 | 63 | import com.ning.org.jboss.netty.handler.codec.http.CookieDecoder;
|
155 | 64 | import com.ning.org.jboss.netty.handler.codec.http.CookieEncoder;
|
| 65 | +import org.jboss.netty.bootstrap.ClientBootstrap; |
| 66 | +import org.jboss.netty.buffer.ChannelBuffer; |
| 67 | +import org.jboss.netty.buffer.ChannelBufferOutputStream; |
| 68 | +import org.jboss.netty.buffer.ChannelBuffers; |
| 69 | +import org.jboss.netty.channel.Channel; |
| 70 | +import org.jboss.netty.channel.ChannelFuture; |
| 71 | +import org.jboss.netty.channel.ChannelFutureProgressListener; |
| 72 | +import org.jboss.netty.channel.ChannelHandlerContext; |
| 73 | +import org.jboss.netty.channel.ChannelPipeline; |
| 74 | +import org.jboss.netty.channel.ChannelPipelineFactory; |
| 75 | +import org.jboss.netty.channel.ChannelStateEvent; |
| 76 | +import org.jboss.netty.channel.DefaultChannelFuture; |
| 77 | +import org.jboss.netty.channel.ExceptionEvent; |
| 78 | +import org.jboss.netty.channel.FileRegion; |
| 79 | +import org.jboss.netty.channel.MessageEvent; |
| 80 | +import org.jboss.netty.channel.SimpleChannelUpstreamHandler; |
| 81 | +import org.jboss.netty.channel.group.ChannelGroup; |
| 82 | +import org.jboss.netty.channel.socket.ClientSocketChannelFactory; |
| 83 | +import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; |
| 84 | +import org.jboss.netty.channel.socket.oio.OioClientSocketChannelFactory; |
| 85 | +import org.jboss.netty.handler.codec.PrematureChannelClosureException; |
| 86 | +import org.jboss.netty.handler.codec.http.DefaultHttpChunkTrailer; |
| 87 | +import org.jboss.netty.handler.codec.http.DefaultHttpRequest; |
| 88 | +import org.jboss.netty.handler.codec.http.HttpChunk; |
| 89 | +import org.jboss.netty.handler.codec.http.HttpChunkTrailer; |
| 90 | +import org.jboss.netty.handler.codec.http.HttpClientCodec; |
| 91 | +import org.jboss.netty.handler.codec.http.HttpContentDecompressor; |
| 92 | +import org.jboss.netty.handler.codec.http.HttpHeaders; |
| 93 | +import org.jboss.netty.handler.codec.http.HttpMethod; |
| 94 | +import org.jboss.netty.handler.codec.http.HttpRequest; |
| 95 | +import org.jboss.netty.handler.codec.http.HttpResponse; |
| 96 | +import org.jboss.netty.handler.codec.http.HttpVersion; |
| 97 | +import org.jboss.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; |
| 98 | +import org.jboss.netty.handler.codec.http.websocketx.CloseWebSocketFrame; |
| 99 | +import org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame; |
| 100 | +import org.jboss.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder; |
| 101 | +import org.jboss.netty.handler.codec.http.websocketx.WebSocket08FrameEncoder; |
| 102 | +import org.jboss.netty.handler.codec.http.websocketx.WebSocketFrame; |
| 103 | +import org.jboss.netty.handler.ssl.SslHandler; |
| 104 | +import org.jboss.netty.handler.stream.ChunkedFile; |
| 105 | +import org.jboss.netty.handler.stream.ChunkedWriteHandler; |
| 106 | +import org.jboss.netty.util.HashedWheelTimer; |
| 107 | +import org.jboss.netty.util.Timeout; |
| 108 | +import org.jboss.netty.util.TimerTask; |
| 109 | +import org.slf4j.Logger; |
| 110 | +import org.slf4j.LoggerFactory; |
| 111 | + |
| 112 | +import javax.net.ssl.SSLEngine; |
| 113 | +import java.io.File; |
| 114 | +import java.io.FileInputStream; |
| 115 | +import java.io.IOException; |
| 116 | +import java.io.RandomAccessFile; |
| 117 | +import java.net.ConnectException; |
| 118 | +import java.net.InetSocketAddress; |
| 119 | +import java.net.MalformedURLException; |
| 120 | +import java.net.URI; |
| 121 | +import java.nio.channels.ClosedChannelException; |
| 122 | +import java.nio.channels.FileChannel; |
| 123 | +import java.nio.channels.WritableByteChannel; |
| 124 | +import java.nio.charset.Charset; |
| 125 | +import java.security.GeneralSecurityException; |
| 126 | +import java.security.NoSuchAlgorithmException; |
| 127 | +import java.util.ArrayList; |
| 128 | +import java.util.List; |
| 129 | +import java.util.Locale; |
| 130 | +import java.util.Map.Entry; |
| 131 | +import java.util.concurrent.Callable; |
| 132 | +import java.util.concurrent.ExecutorService; |
| 133 | +import java.util.concurrent.Executors; |
| 134 | +import java.util.concurrent.RejectedExecutionException; |
| 135 | +import java.util.concurrent.Semaphore; |
| 136 | +import java.util.concurrent.TimeUnit; |
| 137 | +import java.util.concurrent.atomic.AtomicBoolean; |
| 138 | + |
| 139 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.BOSS_EXECUTOR_SERVICE; |
| 140 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.DISABLE_NESTED_REQUEST; |
| 141 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.EXECUTE_ASYNC_CONNECT; |
| 142 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTPS_CLIENT_CODEC_MAX_CHUNK_SIZE; |
| 143 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTPS_CLIENT_CODEC_MAX_HEADER_SIZE; |
| 144 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTPS_CLIENT_CODEC_MAX_INITIAL_LINE_LENGTH; |
| 145 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTP_CLIENT_CODEC_MAX_CHUNK_SIZE; |
| 146 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTP_CLIENT_CODEC_MAX_HEADER_SIZE; |
| 147 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.HTTP_CLIENT_CODEC_MAX_INITIAL_LINE_LENGTH; |
| 148 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.REUSE_ADDRESS; |
| 149 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.SOCKET_CHANNEL_FACTORY; |
| 150 | +import static com.ning.http.client.providers.netty.NettyAsyncHttpProviderConfig.USE_BLOCKING_IO; |
| 151 | +import static com.ning.http.util.AsyncHttpProviderUtils.DEFAULT_CHARSET; |
| 152 | +import static com.ning.http.util.MiscUtil.isNonEmpty; |
| 153 | +import static org.jboss.netty.channel.Channels.pipeline; |
156 | 154 |
|
157 | 155 | public class NettyAsyncHttpProvider extends SimpleChannelUpstreamHandler implements AsyncHttpProvider {
|
158 | 156 |
|
@@ -1688,7 +1686,7 @@ protected static boolean abortOnWriteCloseException(Throwable cause) {
|
1688 | 1686 | }
|
1689 | 1687 |
|
1690 | 1688 | if (cause.getCause() != null) {
|
1691 |
| - return abortOnReadCloseException(cause.getCause()); |
| 1689 | + return abortOnWriteCloseException(cause.getCause()); |
1692 | 1690 | }
|
1693 | 1691 |
|
1694 | 1692 | return false;
|
|
0 commit comments