Skip to content

Commit

Permalink
Merge branch 'main' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
clezag committed Dec 19, 2024
2 parents 4552f5b + f12a503 commit 625c92e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
Expand Down Expand Up @@ -49,6 +50,7 @@ public static CloseableHttpClient httpClient(){
.setConnectTimeout(timeout)
.setSocketTimeout(timeout)
.setConnectionRequestTimeout(timeout)
.setCookieSpec(CookieSpecs.STANDARD)
.build();
return HttpClientBuilder.create().setDefaultRequestConfig(rc).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,19 @@ public AggregatedDataDto[] getAggregatedDataOnStations(String stationId, String
payload.put("IdPostazioni", stationIdArray);
payload.put("InizioPeriodo", startPeriod);
payload.put("FinePeriodo", endPeriod);
StringEntity stringEntity = new StringEntity(String.valueOf(payload),
String payloadString = payload.toJSONString();
StringEntity stringEntity = new StringEntity(payloadString,
ContentType.APPLICATION_JSON);
HttpPost request = new HttpPost(aggregatedDataOnStationsUrl);
request.setEntity(stringEntity);
HttpEntity entity = client.execute(request).getEntity();
String responseString = EntityUtils.toString(entity, RESPONSE_CHARSET);
return objectMapper.readValue(responseString, AggregatedDataDto[].class);
try {
HttpEntity entity = client.execute(request).getEntity();
String responseString = EntityUtils.toString(entity, RESPONSE_CHARSET);
return objectMapper.readValue(responseString, AggregatedDataDto[].class);
} catch (Exception e) {
LOG.error("Dumping request object: " + payloadString);
throw e;
}
}

/**
Expand Down

0 comments on commit 625c92e

Please sign in to comment.