19
19
import java .util .concurrent .ExecutorService ;
20
20
21
21
import org .asynchttpclient .AsyncHttpProviderConfig ;
22
- import org .asynchttpclient .channel . SSLEngineFactory ;
22
+ import org .asynchttpclient .config . AsyncHttpClientConfig ;
23
23
import org .asynchttpclient .netty .channel .pool .ChannelPool ;
24
24
import org .asynchttpclient .netty .handler .ConnectionStrategy ;
25
25
import org .asynchttpclient .netty .handler .Http1Point1ConnectionStrategy ;
26
26
import org .asynchttpclient .netty .ws .NettyWebSocket ;
27
- import org .asynchttpclient .netty .NettyAsyncHttpProviderConfig ;
28
27
import org .jboss .netty .channel .Channel ;
29
28
import org .jboss .netty .channel .ChannelPipeline ;
30
29
import org .jboss .netty .channel .socket .nio .NioClientSocketChannelFactory ;
33
32
import org .jboss .netty .util .Timer ;
34
33
35
34
/**
36
- * This class can be used to pass Netty's internal configuration options. See Netty documentation for more information.
35
+ * This class can be used to pass Netty's internal configuration options. See
36
+ * Netty documentation for more information.
37
37
*/
38
38
public class NettyAsyncHttpProviderConfig implements AsyncHttpProviderConfig <String , Object > {
39
39
40
40
private final ConcurrentHashMap <String , Object > properties = new ConcurrentHashMap <>();
41
41
42
42
/**
43
- * Add a property that will be used when the AsyncHttpClient initialize its {@link com.ning.http.client.AsyncHttpProvider}
43
+ * Add a property that will be used when the AsyncHttpClient initialize its
44
+ * {@link com.ning.http.client.AsyncHttpProvider}
44
45
*
45
- * @param name
46
- * the name of the property
47
- * @param value
48
- * the value of the property
46
+ * @param name the name of the property
47
+ * @param value the value of the property
49
48
* @return this instance of AsyncHttpProviderConfig
50
49
*/
51
50
public NettyAsyncHttpProviderConfig addProperty (String name , Object value ) {
@@ -111,44 +110,17 @@ public Set<Map.Entry<String, Object>> propertiesSet() {
111
110
private AdditionalPipelineInitializer httpsAdditionalPipelineInitializer ;
112
111
private AdditionalPipelineInitializer wssAdditionalPipelineInitializer ;
113
112
114
- /**
115
- * Allow configuring Netty's HttpClientCodecs.
116
- */
117
- private int httpClientCodecMaxInitialLineLength = 4096 ;
118
- private int httpClientCodecMaxHeaderSize = 8192 ;
119
- private int httpClientCodecMaxChunkSize = 8192 ;
120
-
121
113
/**
122
114
* Allow configuring the Netty's socket channel factory.
123
115
*/
124
116
private NioClientSocketChannelFactory socketChannelFactory ;
125
117
126
118
private ChannelPool channelPool ;
127
119
128
- /**
129
- * Allow one to disable zero copy for bodies and use chunking instead
130
- */
131
- private boolean disableZeroCopy ;
132
-
133
120
private Timer nettyTimer ;
134
121
135
- private long handshakeTimeout = 10000L ;
136
-
137
- private SSLEngineFactory sslEngineFactory ;
138
-
139
- /**
140
- * chunkedFileChunkSize
141
- */
142
- private int chunkedFileChunkSize = 8192 ;
143
-
144
122
private NettyWebSocketFactory nettyWebSocketFactory = new DefaultNettyWebSocketFactory ();
145
123
146
- private int webSocketMaxBufferSize = 128000000 ;
147
-
148
- private int webSocketMaxFrameSize = 10 * 1024 ;
149
-
150
- private boolean keepEncodingHeader = false ;
151
-
152
124
private ConnectionStrategy <HttpRequest , HttpResponse > connectionStrategy = new Http1Point1ConnectionStrategy ();
153
125
154
126
public boolean isUseDeadLockChecker () {
@@ -166,7 +138,7 @@ public ExecutorService getBossExecutorService() {
166
138
public void setBossExecutorService (ExecutorService bossExecutorService ) {
167
139
this .bossExecutorService = bossExecutorService ;
168
140
}
169
-
141
+
170
142
public AdditionalPipelineInitializer getHttpAdditionalPipelineInitializer () {
171
143
return httpAdditionalPipelineInitializer ;
172
144
}
@@ -199,30 +171,6 @@ public void setWssAdditionalPipelineInitializer(AdditionalPipelineInitializer ws
199
171
this .wssAdditionalPipelineInitializer = wssAdditionalPipelineInitializer ;
200
172
}
201
173
202
- public int getHttpClientCodecMaxInitialLineLength () {
203
- return httpClientCodecMaxInitialLineLength ;
204
- }
205
-
206
- public void setHttpClientCodecMaxInitialLineLength (int httpClientCodecMaxInitialLineLength ) {
207
- this .httpClientCodecMaxInitialLineLength = httpClientCodecMaxInitialLineLength ;
208
- }
209
-
210
- public int getHttpClientCodecMaxHeaderSize () {
211
- return httpClientCodecMaxHeaderSize ;
212
- }
213
-
214
- public void setHttpClientCodecMaxHeaderSize (int httpClientCodecMaxHeaderSize ) {
215
- this .httpClientCodecMaxHeaderSize = httpClientCodecMaxHeaderSize ;
216
- }
217
-
218
- public int getHttpClientCodecMaxChunkSize () {
219
- return httpClientCodecMaxChunkSize ;
220
- }
221
-
222
- public void setHttpClientCodecMaxChunkSize (int httpClientCodecMaxChunkSize ) {
223
- this .httpClientCodecMaxChunkSize = httpClientCodecMaxChunkSize ;
224
- }
225
-
226
174
public NioClientSocketChannelFactory getSocketChannelFactory () {
227
175
return socketChannelFactory ;
228
176
}
@@ -231,14 +179,6 @@ public void setSocketChannelFactory(NioClientSocketChannelFactory socketChannelF
231
179
this .socketChannelFactory = socketChannelFactory ;
232
180
}
233
181
234
- public void setDisableZeroCopy (boolean disableZeroCopy ) {
235
- this .disableZeroCopy = disableZeroCopy ;
236
- }
237
-
238
- public boolean isDisableZeroCopy () {
239
- return disableZeroCopy ;
240
- }
241
-
242
182
public Timer getNettyTimer () {
243
183
return nettyTimer ;
244
184
}
@@ -247,14 +187,6 @@ public void setNettyTimer(Timer nettyTimer) {
247
187
this .nettyTimer = nettyTimer ;
248
188
}
249
189
250
- public long getHandshakeTimeout () {
251
- return handshakeTimeout ;
252
- }
253
-
254
- public void setHandshakeTimeout (long handshakeTimeout ) {
255
- this .handshakeTimeout = handshakeTimeout ;
256
- }
257
-
258
190
public ChannelPool getChannelPool () {
259
191
return channelPool ;
260
192
}
@@ -263,22 +195,6 @@ public void setChannelPool(ChannelPool channelPool) {
263
195
this .channelPool = channelPool ;
264
196
}
265
197
266
- public SSLEngineFactory getSslEngineFactory () {
267
- return sslEngineFactory ;
268
- }
269
-
270
- public void setSslEngineFactory (SSLEngineFactory sslEngineFactory ) {
271
- this .sslEngineFactory = sslEngineFactory ;
272
- }
273
-
274
- public int getChunkedFileChunkSize () {
275
- return chunkedFileChunkSize ;
276
- }
277
-
278
- public void setChunkedFileChunkSize (int chunkedFileChunkSize ) {
279
- this .chunkedFileChunkSize = chunkedFileChunkSize ;
280
- }
281
-
282
198
public NettyWebSocketFactory getNettyWebSocketFactory () {
283
199
return nettyWebSocketFactory ;
284
200
}
@@ -287,30 +203,6 @@ public void setNettyWebSocketFactory(NettyWebSocketFactory nettyWebSocketFactory
287
203
this .nettyWebSocketFactory = nettyWebSocketFactory ;
288
204
}
289
205
290
- public int getWebSocketMaxBufferSize () {
291
- return webSocketMaxBufferSize ;
292
- }
293
-
294
- public void setWebSocketMaxBufferSize (int webSocketMaxBufferSize ) {
295
- this .webSocketMaxBufferSize = webSocketMaxBufferSize ;
296
- }
297
-
298
- public int getWebSocketMaxFrameSize () {
299
- return webSocketMaxFrameSize ;
300
- }
301
-
302
- public void setWebSocketMaxFrameSize (int webSocketMaxFrameSize ) {
303
- this .webSocketMaxFrameSize = webSocketMaxFrameSize ;
304
- }
305
-
306
- public boolean isKeepEncodingHeader () {
307
- return keepEncodingHeader ;
308
- }
309
-
310
- public void setKeepEncodingHeader (boolean keepEncodingHeader ) {
311
- this .keepEncodingHeader = keepEncodingHeader ;
312
- }
313
-
314
206
public ConnectionStrategy <HttpRequest , HttpResponse > getConnectionStrategy () {
315
207
return connectionStrategy ;
316
208
}
@@ -320,7 +212,7 @@ public void setConnectionStrategy(ConnectionStrategy<HttpRequest, HttpResponse>
320
212
}
321
213
322
214
public static interface NettyWebSocketFactory {
323
- NettyWebSocket newNettyWebSocket (Channel channel , NettyAsyncHttpProviderConfig nettyConfig );
215
+ NettyWebSocket newNettyWebSocket (Channel channel , AsyncHttpClientConfig config );
324
216
}
325
217
326
218
public static interface AdditionalPipelineInitializer {
@@ -331,8 +223,8 @@ public static interface AdditionalPipelineInitializer {
331
223
public class DefaultNettyWebSocketFactory implements NettyWebSocketFactory {
332
224
333
225
@ Override
334
- public NettyWebSocket newNettyWebSocket (Channel channel , NettyAsyncHttpProviderConfig nettyConfig ) {
335
- return new NettyWebSocket (channel , nettyConfig );
226
+ public NettyWebSocket newNettyWebSocket (Channel channel , AsyncHttpClientConfig config ) {
227
+ return new NettyWebSocket (channel , config );
336
228
}
337
229
}
338
230
}
0 commit comments