11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
4343 * across multiple clients.
4444 *
4545 * @author Arjen Poutsma
46+ * @author Rossen Stoyanchev
4647 * @since 4.1.2
4748 */
4849public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory ,
@@ -51,16 +52,25 @@ public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory,
5152 /**
5253 * The default maximum request size.
5354 * @see #setMaxRequestSize(int)
55+ * @deprecated
5456 */
5557 public static final int DEFAULT_MAX_REQUEST_SIZE = 1024 * 1024 * 10 ;
5658
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+
5765
5866 private final EventLoopGroup eventLoopGroup ;
5967
6068 private final boolean defaultEventLoopGroup ;
6169
6270 private int maxRequestSize = DEFAULT_MAX_REQUEST_SIZE ;
6371
72+ private int maxResponseSize = DEFAULT_MAX_REQUEST_SIZE ;
73+
6474 private SslContext sslContext ;
6575
6676 private volatile Bootstrap bootstrap ;
@@ -94,11 +104,24 @@ public Netty4ClientHttpRequestFactory(EventLoopGroup eventLoopGroup) {
94104 * Set the default maximum request size.
95105 * <p>By default this is set to {@link #DEFAULT_MAX_REQUEST_SIZE}.
96106 * @see HttpObjectAggregator#HttpObjectAggregator(int)
107+ * @deprecated as of 4.1.5 this property is no longer supported;
108+ * effectively renamed to {@link #setMaxResponseSize(int)}.
97109 */
98110 public void setMaxRequestSize (int maxRequestSize ) {
99111 this .maxRequestSize = maxRequestSize ;
100112 }
101113
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+
102125 /**
103126 * Set the SSL context. When configured it is used to create and insert an
104127 * {@link io.netty.handler.ssl.SslHandler} in the channel pipeline.
@@ -120,7 +143,7 @@ protected void initChannel(SocketChannel channel) throws Exception {
120143 pipeline .addLast (sslContext .newHandler (channel .alloc ()));
121144 }
122145 pipeline .addLast (new HttpClientCodec ());
123- pipeline .addLast (new HttpObjectAggregator (maxRequestSize ));
146+ pipeline .addLast (new HttpObjectAggregator (maxResponseSize ));
124147 }
125148 });
126149 this .bootstrap = bootstrap ;
0 commit comments