@@ -27,24 +27,9 @@ public class SearchImageService {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
// private final OkHttpClient httpClient;
|
||||
private final OkHttpClient yandexHttpClient;
|
||||
private final OkHttpClient googleHttpClient;
|
||||
|
||||
// public SearchImageService() {
|
||||
// this.httpClient = new OkHttpClient.Builder()
|
||||
// .connectTimeout(18, TimeUnit.SECONDS)
|
||||
// .writeTimeout(18, TimeUnit.SECONDS)
|
||||
// .readTimeout(18, TimeUnit.SECONDS)
|
||||
// .callTimeout(18, TimeUnit.SECONDS)
|
||||
// .followRedirects(true)
|
||||
// .followSslRedirects(true)
|
||||
// .retryOnConnectionFailure(true)
|
||||
// .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
// .build();
|
||||
//
|
||||
// this.objectMapper = new ObjectMapper();
|
||||
// }
|
||||
private final OkHttpClient googleHttpClient;
|
||||
|
||||
public SearchImageService() {
|
||||
Proxy proxy = new Proxy(Proxy.Type.HTTP,
|
||||
@@ -59,7 +44,6 @@ public class SearchImageService {
|
||||
.followRedirects(true)
|
||||
.followSslRedirects(true)
|
||||
.retryOnConnectionFailure(true)
|
||||
// .protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
.build();
|
||||
|
||||
@@ -72,7 +56,6 @@ public class SearchImageService {
|
||||
.followRedirects(true)
|
||||
.followSslRedirects(true)
|
||||
.retryOnConnectionFailure(true)
|
||||
// .protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
.build();
|
||||
|
||||
@@ -154,14 +137,6 @@ public class SearchImageService {
|
||||
.header("User-Agent", "Mozilla/5.0")
|
||||
.build();
|
||||
|
||||
// Request request = new Request.Builder()
|
||||
// .url(url)
|
||||
// .header("Accept", "*/*")
|
||||
// .header("User-Agent", "PostmanRuntime/7.29.2")
|
||||
// .header("Accept-Encoding", "gzip, deflate")
|
||||
// .header("Connection", "keep-alive")
|
||||
// .build();
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
|
||||
Reference in New Issue
Block a user