Skip to content

Commit 9186ac0

Browse files
committed
Implments #54
1 parent 94f5ac8 commit 9186ac0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/main/java/es/upv/i3m/grycap/im/rest/client/ImClient.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,30 @@ public ImClient(final String targetUrl, final String authorizationHeader)
8686
this.client = createRestClient();
8787
}
8888

89+
/**
90+
* Creates a new client using the 'imServiceUrl' as endpoint.<br>
91+
* Loads the authorization credentials from the 'authorizationHeader'
92+
* parameter. It also enables to set the read and connection timeouts.
93+
*
94+
* @param targetUrl
95+
* : url of the IM rest service
96+
* @param authorizationHeader
97+
* : string with the authorization content
98+
* @param connectTimeout
99+
* : int with the client connection timeout
100+
* @param readTimeout
101+
* : int with the client read timeout
102+
*/
103+
public ImClient(final String targetUrl, final String authorizationHeader,
104+
final int connectTimeout, final int readTimeout)
105+
throws ImClientException {
106+
this.targetUrl = targetUrl;
107+
this.authorizationHeader = authorizationHeader;
108+
this.client = createRestClient();
109+
this.client.property("jersey.config.client.connectTimeout", connectTimeout);
110+
this.client.property("jersey.config.client.readTimeout", readTimeout);
111+
}
112+
89113
/**
90114
* Creates a new REST client based on the target URL.
91115
*/

0 commit comments

Comments
 (0)