Add max-buffer-size and fix app deps
This commit is contained in:
committed by
Soby Chacko
parent
f863db2af1
commit
d13a1fceaf
@@ -47,8 +47,10 @@ public class HttpRequestFunctionConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(WebClient.class)
|
||||
public WebClient webClient() {
|
||||
public WebClient webClient(HttpRequestFunctionProperties properties) {
|
||||
return WebClient.builder()
|
||||
.codecs(clientCodecConfigurer ->
|
||||
clientCodecConfigurer.defaultCodecs().maxInMemorySize(properties.getMaximumBufferSize()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.fn.http.request;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.expression.Expression;
|
||||
@@ -51,6 +52,13 @@ public class HttpRequestFunctionProperties {
|
||||
*/
|
||||
private long timeout = 30_000;
|
||||
|
||||
/**
|
||||
* Maximum buffer size in bytes allocated for input stream buffers. Defaults to 256k.
|
||||
* Increase, as necessary, for posting or getting large binary content.
|
||||
*/
|
||||
|
||||
private int maximumBufferSize = 256 * 1024;
|
||||
|
||||
/**
|
||||
* A SpEL expression against incoming message to determine the URL to use.
|
||||
*/
|
||||
@@ -111,6 +119,15 @@ public class HttpRequestFunctionProperties {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
@Positive
|
||||
public int getMaximumBufferSize() {
|
||||
return maximumBufferSize;
|
||||
}
|
||||
|
||||
public void setMaximumBufferSize(int maximumBufferSize) {
|
||||
this.maximumBufferSize = maximumBufferSize;
|
||||
}
|
||||
|
||||
public Expression getBodyExpression() {
|
||||
return bodyExpression;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user