1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
43
43
* across multiple clients.
44
44
*
45
45
* @author Arjen Poutsma
46
+ * @author Rossen Stoyanchev
46
47
* @since 4.1.2
47
48
*/
48
49
public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory ,
@@ -51,16 +52,25 @@ public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory,
51
52
/**
52
53
* The default maximum request size.
53
54
* @see #setMaxRequestSize(int)
55
+ * @deprecated
54
56
*/
55
57
public static final int DEFAULT_MAX_REQUEST_SIZE = 1024 * 1024 * 10 ;
56
58
59
+ /**
60
+ * The default maximum response size.
61
+ * @see #setMaxResponseSize(int)
62
+ */
63
+ public static final int DEFAULT_MAX_RESPONSE_SIZE = 1024 * 1024 * 10 ;
64
+
57
65
58
66
private final EventLoopGroup eventLoopGroup ;
59
67
60
68
private final boolean defaultEventLoopGroup ;
61
69
62
70
private int maxRequestSize = DEFAULT_MAX_REQUEST_SIZE ;
63
71
72
+ private int maxResponseSize = DEFAULT_MAX_REQUEST_SIZE ;
73
+
64
74
private SslContext sslContext ;
65
75
66
76
private volatile Bootstrap bootstrap ;
@@ -94,11 +104,24 @@ public Netty4ClientHttpRequestFactory(EventLoopGroup eventLoopGroup) {
94
104
* Set the default maximum request size.
95
105
* <p>By default this is set to {@link #DEFAULT_MAX_REQUEST_SIZE}.
96
106
* @see HttpObjectAggregator#HttpObjectAggregator(int)
107
+ * @deprecated as of 4.1.5 this property is no longer supported;
108
+ * effectively renamed to {@link #setMaxResponseSize(int)}.
97
109
*/
98
110
public void setMaxRequestSize (int maxRequestSize ) {
99
111
this .maxRequestSize = maxRequestSize ;
100
112
}
101
113
114
+ /**
115
+ * Set the default maximum response size.
116
+ * <p>By default this is set to {@link #DEFAULT_MAX_RESPONSE_SIZE}.
117
+ * @see HttpObjectAggregator#HttpObjectAggregator(int)
118
+ * @since 4.1.5
119
+ */
120
+ public void setMaxResponseSize (int maxResponseSize ) {
121
+ this .maxResponseSize = maxResponseSize ;
122
+ }
123
+
124
+
102
125
/**
103
126
* Set the SSL context. When configured it is used to create and insert an
104
127
* {@link io.netty.handler.ssl.SslHandler} in the channel pipeline.
@@ -120,7 +143,7 @@ protected void initChannel(SocketChannel channel) throws Exception {
120
143
pipeline .addLast (sslContext .newHandler (channel .alloc ()));
121
144
}
122
145
pipeline .addLast (new HttpClientCodec ());
123
- pipeline .addLast (new HttpObjectAggregator (maxRequestSize ));
146
+ pipeline .addLast (new HttpObjectAggregator (maxResponseSize ));
124
147
}
125
148
});
126
149
this .bootstrap = bootstrap ;
0 commit comments