This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.0.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.0.x by this push: new edcb1cb CAMEL-14424: HTTP responses over 4 MB fail (#3505) edcb1cb is described below commit edcb1cbf22dce2acf3834241b32e807f664ad90a Author: Jeremy Ross <jer...@jeremyross.org> AuthorDate: Wed Jan 22 23:25:59 2020 -0600 CAMEL-14424: HTTP responses over 4 MB fail (#3505) This commit allows the user to overwrite the default http client max content length of 4 MB. --- .../camel/component/salesforce/SalesforceComponent.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java index 2a116a5..933f7d9 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java @@ -79,6 +79,7 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP public static final String HTTP_PROXY_REALM = "httpProxyRealm"; public static final String HTTP_CONNECTION_TIMEOUT = "httpConnectionTimeout"; public static final String HTTP_IDLE_TIMEOUT = "httpIdleTimeout"; + public static final String HTTP_MAX_CONTENT_LENGTH = "httpMaxContentLength"; static final int CONNECTION_TIMEOUT = 60000; static final int IDLE_TIMEOUT = 10000; @@ -146,6 +147,9 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP @Metadata(description = "Connection timeout used by the HttpClient when connecting to the Salesforce server.", label = "common", defaultValue = "" + CONNECTION_TIMEOUT) private long httpClientConnectionTimeout = CONNECTION_TIMEOUT; + @Metadata(description = "Max content length of an HTTP response.", label = "common") + private Integer httpMaxContentLength; + @Metadata(description = "Used to set any properties that can be configured on the underlying HTTP client. Have a" + " look at properties of SalesforceHttpClient and the Jetty HttpClient for all available options.", label = "common,advanced") private Map<String, Object> httpClientProperties; @@ -545,6 +549,14 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP this.httpClientConnectionTimeout = httpClientConnectionTimeout; } + public Integer getHttpMaxContentLength() { + return httpMaxContentLength; + } + + public void setHttpMaxContentLength(Integer httpMaxContentLength) { + this.httpMaxContentLength = httpMaxContentLength; + } + public String getHttpProxyHost() { return httpProxyHost; } @@ -729,6 +741,7 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP final Long httpConnectionTimeout = typeConverter.convertTo(Long.class, httpClientProperties.get(HTTP_CONNECTION_TIMEOUT)); final Long httpIdleTimeout = typeConverter.convertTo(Long.class, httpClientProperties.get(HTTP_IDLE_TIMEOUT)); + final Integer maxContentLength = typeConverter.convertTo(Integer.class, httpClientProperties.get(HTTP_MAX_CONTENT_LENGTH)); final String httpProxyHost = typeConverter.convertTo(String.class, httpClientProperties.get(HTTP_PROXY_HOST)); final Integer httpProxyPort = typeConverter.convertTo(Integer.class, httpClientProperties.get(HTTP_PROXY_PORT)); @@ -751,6 +764,9 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP if (httpConnectionTimeout != null) { httpClient.setConnectTimeout(httpConnectionTimeout); } + if (maxContentLength != null) { + httpClient.setMaxContentLength(maxContentLength); + } // set HTTP proxy settings if (httpProxyHost != null && httpProxyPort != null) { @@ -797,6 +813,7 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP putValueIfGivenTo(httpClientProperties, HTTP_PROXY_PASSWORD, salesforce::getHttpProxyPassword); putValueIfGivenTo(httpClientProperties, HTTP_PROXY_REALM, salesforce::getHttpProxyRealm); putValueIfGivenTo(httpClientProperties, HTTP_PROXY_AUTH_URI, salesforce::getHttpProxyAuthUri); + putValueIfGivenTo(httpClientProperties, HTTP_MAX_CONTENT_LENGTH, salesforce::getHttpMaxContentLength); if (ObjectHelper.isNotEmpty(salesforce.getHttpProxyHost())) { // let's not put `false` values in client properties if no proxy is