Commit 3fb77067 authored by Matija Obreza's avatar Matija Obreza
Browse files

UTF-8

parent 48552d83
......@@ -139,13 +139,14 @@ public class GenesysClient {
if (postBody != null) {
// System.err.println("Adding data: " + data);
request.addPayload(postBody);
request.addHeader("Content-Type", "application/json");
request.addHeader("Content-Type", "application/json;charset=utf-8");
}
service.signRequest(accessToken, request);
request.setConnectionKeepAlive(true);
request.setConnectTimeout(10, TimeUnit.SECONDS);
request.setReadTimeout(30, TimeUnit.SECONDS);
request.setCharset("UTF-8");
Response response = null;
try {
......@@ -248,7 +249,7 @@ public class GenesysClient {
return query(Verb.PUT, "/acn/" + instCode + "/check", null, arr.toString());
}
public String updateAccessions(String instCode, Collection<ObjectNode> accns) throws GenesysApiException {
public String updateAccessions(String instCode, Collection<ObjectNode> accns) throws GenesysApiException, InterruptedException {
if (accns == null || accns.size() == 0) {
return null;
......@@ -259,6 +260,10 @@ public class GenesysClient {
arr.add(accn);
}
return updateAccessions(instCode, arr);
}
public String updateAccessions(String instCode, ArrayNode arr) throws OAuthAuthenticationException, GenesysApiException, InterruptedException {
_log.debug("Sending: " + arr);
for (int retry = 0; retry < 5; retry++) {
......@@ -267,10 +272,7 @@ public class GenesysClient {
} catch (PleaseRetryException e) {
long sleepTime = (long) (Math.pow(2, retry) * 100 + Math.pow(2, retry) * 2500 * Math.random());
_log.warn("Retrying PUT after " + sleepTime + " ms.");
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e1) {
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment