@@ -59,8 +59,8 @@ public class SearchImageService {
|
||||
.followRedirects(true)
|
||||
.followSslRedirects(true)
|
||||
.retryOnConnectionFailure(true)
|
||||
.protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||
// .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
// .protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
.build();
|
||||
|
||||
this.googleHttpClient = new OkHttpClient.Builder()
|
||||
@@ -72,8 +72,8 @@ public class SearchImageService {
|
||||
.followRedirects(true)
|
||||
.followSslRedirects(true)
|
||||
.retryOnConnectionFailure(true)
|
||||
.protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||
// .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
// .protocols(Arrays.asList(Protocol.HTTP_1_1))
|
||||
.connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS))
|
||||
.build();
|
||||
|
||||
this.objectMapper = new ObjectMapper();
|
||||
@@ -148,20 +148,20 @@ public class SearchImageService {
|
||||
.addQueryParameter("t_", String.valueOf(System.currentTimeMillis()))
|
||||
.build();
|
||||
|
||||
// Request request = new Request.Builder()
|
||||
// .url(url)
|
||||
// .header("Accept", "application/json")
|
||||
// .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")
|
||||
.header("Accept", "application/json")
|
||||
.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