private void writeResponse(HttpRequest request, HttpResponse response, Channel channel) {
			boolean keepAlive = isKeepAlive(request);
			if (keepAlive) {
				response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes());
				response.setHeader(CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
			}
			if (logger.isDebugEnabled()) {
				logger.debug("Sending HTTP response:\n" + indent(response.toString()));
			}
			ChannelFuture future = channel.write(response);
			if (!keepAlive) {
				future.addListener(ChannelFutureListener.CLOSE);
			}
		}
Set the max content length; default 1Mb.
@param maxContentLength the max content length.
extensions/spring-xd-extension-http/src/main/java/org/springframework/integration/x/http/NettyHttpInboundChannelAdapter.java