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

UTF-8

parent 48552d83
...@@ -139,13 +139,14 @@ public class GenesysClient { ...@@ -139,13 +139,14 @@ public class GenesysClient {
if (postBody != null) { if (postBody != null) {
// System.err.println("Adding data: " + data); // System.err.println("Adding data: " + data);
request.addPayload(postBody); request.addPayload(postBody);
request.addHeader("Content-Type", "application/json"); request.addHeader("Content-Type", "application/json;charset=utf-8");
} }
service.signRequest(accessToken, request); service.signRequest(accessToken, request);
request.setConnectionKeepAlive(true); request.setConnectionKeepAlive(true);
request.setConnectTimeout(10, TimeUnit.SECONDS); request.setConnectTimeout(10, TimeUnit.SECONDS);
request.setReadTimeout(30, TimeUnit.SECONDS); request.setReadTimeout(30, TimeUnit.SECONDS);
request.setCharset("UTF-8");
Response response = null; Response response = null;
try { try {
...@@ -248,7 +249,7 @@ public class GenesysClient { ...@@ -248,7 +249,7 @@ public class GenesysClient {
return query(Verb.PUT, "/acn/" + instCode + "/check", null, arr.toString()); 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) { if (accns == null || accns.size() == 0) {
return null; return null;
...@@ -259,6 +260,10 @@ public class GenesysClient { ...@@ -259,6 +260,10 @@ public class GenesysClient {
arr.add(accn); arr.add(accn);
} }
return updateAccessions(instCode, arr);
}
public String updateAccessions(String instCode, ArrayNode arr) throws OAuthAuthenticationException, GenesysApiException, InterruptedException {
_log.debug("Sending: " + arr); _log.debug("Sending: " + arr);
for (int retry = 0; retry < 5; retry++) { for (int retry = 0; retry < 5; retry++) {
...@@ -267,10 +272,7 @@ public class GenesysClient { ...@@ -267,10 +272,7 @@ public class GenesysClient {
} catch (PleaseRetryException e) { } catch (PleaseRetryException e) {
long sleepTime = (long) (Math.pow(2, retry) * 100 + Math.pow(2, retry) * 2500 * Math.random()); long sleepTime = (long) (Math.pow(2, retry) * 100 + Math.pow(2, retry) * 2500 * Math.random());
_log.warn("Retrying PUT after " + sleepTime + " ms."); _log.warn("Retrying PUT after " + sleepTime + " ms.");
try { Thread.sleep(sleepTime);
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