Skip to content

Commit cb82746

Browse files
authored
Merge pull request #350 from IBMStreams/develop
Develop version 3.2.0
2 parents 3eb973c + 1cc4591 commit cb82746

File tree

21 files changed

+2704
-19
lines changed

21 files changed

+2704
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22
=======
3+
## v3.2.0
4+
* Update apache http client library to v 4.5.12
5+
* HTTPRequest operator: Introduce parameter socketTimeout
6+
37
## v3.1.2:
48
* Update globalization messages
59
* Removed languages ko_KR, ru_RU

com.ibm.streamsx.inet/.classpath

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
<classpathentry kind="src" path="impl/java/src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
55
<classpathentry kind="con" path="com.ibm.streams.java/com.ibm.streams.operator"/>
6-
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.7/lib/commons-codec-1.11.jar"/>
7-
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.7/lib/commons-logging-1.2.jar"/>
8-
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.7/lib/httpclient-4.5.7.jar"/>
9-
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.7/lib/httpclient-cache-4.5.7.jar"/>
10-
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.7/lib/httpcore-4.4.11.jar"/>
11-
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.7/lib/httpmime-4.5.7.jar"/>
126
<classpathentry kind="lib" path="opt/signpost-1.2/lib/signpost-core-1.2.jar"/>
137
<classpathentry kind="lib" path="opt/signpost-1.2/lib/signpost-commonshttp4-1.2.1.1.jar"/>
148
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
@@ -17,5 +11,11 @@
1711
<attribute name="optional" value="true"/>
1812
</attributes>
1913
</classpathentry>
14+
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.12/lib/commons-codec-1.11.jar"/>
15+
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.12/lib/commons-logging-1.2.jar"/>
16+
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.12/lib/httpclient-cache-4.5.12.jar"/>
17+
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.12/lib/httpcore-4.4.13.jar"/>
18+
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.12/lib/httpmime-4.5.12.jar"/>
19+
<classpathentry kind="lib" path="opt/httpcomponents-client-4.5.12/lib/httpclient-4.5.12.jar"/>
2020
<classpathentry kind="output" path="impl/java/studio-build"/>
2121
</classpath>

com.ibm.streamsx.inet/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ All required libs are now available in the source repository
4040
<path id="cp.manifest">
4141
<fileset dir="opt">
4242
<include name="signpost-1.2/lib/*.jar"/>
43-
<include name="httpcomponents-client-4.5.7/lib/*.jar"/>
43+
<include name="httpcomponents-client-4.5.12/lib/*.jar"/>
4444
</fileset>
4545
</path>
4646

com.ibm.streamsx.inet/impl/java/src/com/ibm/streamsx/inet/http/HTTPRequestOper.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.apache.http.StatusLine;
2828
import org.apache.http.client.ClientProtocolException;
2929
import org.apache.http.client.config.RequestConfig;
30+
import org.apache.http.client.config.RequestConfig.Builder;
3031
import org.apache.http.client.entity.UrlEncodedFormEntity;
3132
import org.apache.http.client.methods.HttpDelete;
3233
import org.apache.http.client.methods.HttpGet;
@@ -337,11 +338,19 @@ private void signRequest(HttpRequestBase request, Tuple tuple) throws OAuthMessa
337338
* set conn params
338339
**************************************************/
339340
private void setConnectionParams(HttpRequestBase request) {
340-
if (getConnectionTimeout() > 0) {
341-
if (tracer.isLoggable(TraceLevel.DEBUG))
342-
tracer.log(TraceLevel.DEBUG, "client configuration: setConnectTimeout=" + new Integer(getConnectionTimeout()).toString());
343-
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(getConnectionTimeout()).build();
344-
request.setConfig(requestConfig);
341+
if ((getConnectionTimeout() > 0) || (getSocketTimeout() >= 0)) {
342+
Builder requestConfigBuilder = RequestConfig.custom();
343+
if (getConnectionTimeout() > 0) {
344+
if (tracer.isLoggable(TraceLevel.DEBUG))
345+
tracer.log(TraceLevel.DEBUG, "client configuration: setConnectTimeout=" + new Integer(getConnectionTimeout()).toString());
346+
requestConfigBuilder = requestConfigBuilder.setConnectTimeout(getConnectionTimeout());
347+
}
348+
if (getSocketTimeout() >= 0) {
349+
if (tracer.isLoggable(TraceLevel.DEBUG))
350+
tracer.log(TraceLevel.DEBUG, "client configuration: setSocketTimeout=" + new Integer(getSocketTimeout()).toString());
351+
requestConfigBuilder = requestConfigBuilder.setSocketTimeout(getSocketTimeout());
352+
}
353+
request.setConfig(requestConfigBuilder.build());
345354
}
346355
}
347356
/******************************************************************************************************************

com.ibm.streamsx.inet/impl/java/src/com/ibm/streamsx/inet/http/HTTPRequestOperAPI.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public enum RedirectStrategy {
157157
private boolean disableContentCompression = false;
158158
private boolean disableAutomaticRetries = false;
159159
private int connectionTimeout = 0;
160+
private int socketTimeout = -1;
160161
private String userAgent = null;
161162

162163
//internal operator state
@@ -426,11 +427,20 @@ public void setDisableContentCompression(boolean disableContentCompression) {
426427
public void setDisableAutomaticRetries(boolean disableAutomaticRetries) {
427428
this.disableAutomaticRetries = disableAutomaticRetries;
428429
}
429-
@Parameter(optional=true, description="Set the connection timeout in milliseconds. If value is 0, the default connection timeout is used. Default is 0.")
430+
@Parameter(optional=true, description="Set the connection timeout in milliseconds. If value is 0, the default connection timeout is used. "
431+
+ "(You cannot specify a connection timeout that increases the platform default (130sec.); you can only use it to decrease the platform default. "
432+
+ "Default is 0.")
430433
public void setConnectionTimeout(int connectionTimeout) {
431434
this.connectionTimeout = connectionTimeout;
432435
}
433-
@Parameter(optional=true, description="Assigns the header User-Agent value. Default is \\\"Apache-HttpClient/4.5.5 (Java/1.8.0)\\\"")
436+
@Parameter(optional=true, description="Set the socket timeout in milliseconds, which is the timeout for waiting for data "
437+
+ "(request-response cycle). "
438+
+ "A timeout value of zero is interpreted as an infinite timeout. A negative value is interpreted as system default. "
439+
+ "Default is -1.")
440+
public void setSocketTimeout(int socketTimeout) {
441+
this.socketTimeout = socketTimeout;
442+
}
443+
@Parameter(optional=true, description="Assigns the header User-Agent value. Default is \\\"Apache-HttpClient/4.5.12 (Java/1.8.0_231)\\\"")
434444
public void setUserAgent(String userAgent) {
435445
this.userAgent = userAgent;
436446
}
@@ -753,6 +763,7 @@ protected boolean isRequestAttribute(Object name) {
753763
protected boolean getDisableContentCompression() { return disableContentCompression; }
754764
protected boolean getDisableAutomaticRetries() { return disableAutomaticRetries; }
755765
protected int getConnectionTimeout() { return connectionTimeout; }
766+
protected int getSocketTimeout() { return socketTimeout; }
756767
protected String getUserAgent() { return userAgent; }
757768

758769
//internal operator state

com.ibm.streamsx.inet/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This toolkit separates its functionality into a number of namespaces:
1515
The http rest functions and the WebSocket server functions are now moved into streamsx.inetserver toolkit https://github.com/IBMStreams/streamsx.inetserver/releases
1616

1717
</description>
18-
<version>3.1.2</version>
18+
<version>3.2.0</version>
1919
<requiredProductVersion>4.0.1.0</requiredProductVersion>
2020
</identity>
2121
<dependencies/>

com.ibm.streamsx.inet/opt/httpcomponents-client-4.5.7/LICENSE.txt renamed to com.ibm.streamsx.inet/opt/httpcomponents-client-4.5.12/LICENSE.txt

File renamed without changes.

com.ibm.streamsx.inet/opt/httpcomponents-client-4.5.7/NOTICE.txt renamed to com.ibm.streamsx.inet/opt/httpcomponents-client-4.5.12/NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Apache HttpComponents Client
2-
Copyright 1999-2019 The Apache Software Foundation
2+
Copyright 1999-2020 The Apache Software Foundation
33

44
This product includes software developed at
55
The Apache Software Foundation (http://www.apache.org/).

com.ibm.streamsx.inet/opt/httpcomponents-client-4.5.7/README.txt renamed to com.ibm.streamsx.inet/opt/httpcomponents-client-4.5.12/README.txt

File renamed without changes.

0 commit comments

Comments
 (0)