@@ -32,10 +32,11 @@ public class SearchImageService {
|
|||||||
private final OkHttpClient googleHttpClient;
|
private final OkHttpClient googleHttpClient;
|
||||||
|
|
||||||
public SearchImageService() {
|
public SearchImageService() {
|
||||||
// Proxy proxy = new Proxy(Proxy.Type.HTTP,
|
Proxy proxy = new Proxy(Proxy.Type.HTTP,
|
||||||
// new InetSocketAddress("193.46.217.94", 3128));
|
new InetSocketAddress("193.46.217.94", 3128));
|
||||||
|
|
||||||
this.yandexHttpClient = new OkHttpClient.Builder()
|
this.yandexHttpClient = new OkHttpClient.Builder()
|
||||||
|
// .proxy(proxy)
|
||||||
.connectTimeout(60, TimeUnit.SECONDS)
|
.connectTimeout(60, TimeUnit.SECONDS)
|
||||||
.writeTimeout(60, TimeUnit.SECONDS)
|
.writeTimeout(60, TimeUnit.SECONDS)
|
||||||
.readTimeout(60, TimeUnit.SECONDS)
|
.readTimeout(60, TimeUnit.SECONDS)
|
||||||
@@ -148,6 +149,10 @@ public class SearchImageService {
|
|||||||
|
|
||||||
String responseBody = body.string();
|
String responseBody = body.string();
|
||||||
|
|
||||||
|
log.info("responseBody: " + responseBody);
|
||||||
|
log.info("responseBody: " + responseBody);
|
||||||
|
log.info("responseBody: " + responseBody);
|
||||||
|
|
||||||
if (!response.isSuccessful()) {
|
if (!response.isSuccessful()) {
|
||||||
throw new IOException("API error " + response.code() + ": " + responseBody);
|
throw new IOException("API error " + response.code() + ": " + responseBody);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user