use of org.stepik.api.client.HttpTransportClient in project intellij-plugins by StepicOrg.
the class StepikAuthManager method initStepikApiClient.
@NotNull
private static synchronized StepikApiClient initStepikApiClient() {
String osName = System.getProperty("os.name");
String jre = System.getProperty("java.version");
String userAgent = String.format("Stepik Union/%s (%s) StepikApiClient/%s %s/%s JRE/%s", getVersion(), osName, StepikApiClient.getVersion(), getCurrentProduct(), getCurrentProductVersion(), jre);
logger.info(userAgent);
HttpConfigurable instance = HttpConfigurable.getInstance();
StepikApiClient client;
if (instance.USE_HTTP_PROXY) {
logger.info(String.format("Uses proxy: Host = %s, Port = %s", instance.PROXY_HOST, instance.PROXY_PORT));
HttpTransportClient transportClient;
transportClient = HttpTransportClient.getInstance(instance.PROXY_HOST, instance.PROXY_PORT, userAgent);
client = new StepikApiClient(transportClient);
} else {
client = new StepikApiClient(userAgent);
}
long lastUserId = getLastUser();
TokenInfo tokenInfo = getTokenInfo(lastUserId, client);
client.setTokenInfo(tokenInfo);
return client;
}
Aggregations