RequestConfig.Builder config = RequestConfig.custom();
method.setEntity(new StringEntity(harvestResponse));
config.setAuthenticationEnabled(false);
method.setConfig(config.build());
final ClientHttpResponse httpResponse = applicationContext.getBean(GeonetHttpRequestFactory.class).execute(method,
new Function<HttpClientBuilder, Void>() {
@Nullable
@Override
public Void apply(@Nonnull HttpClientBuilder input) {
SettingManager settingManager = applicationContext.getBean(SettingManager.class);
Lib.net.setupProxy(settingManager, input);
input.setRetryHandler(new DefaultHttpRequestRetryHandler());
return null;
}
});
if (httpResponse.getStatusCode() != HttpStatus.OK) {
// never mind, just log it
Log.warning(Geonet.CSW_HARVEST, "WARNING: Failed to send HarvestResponse to responseHandler " + responseHandler + ", HTTP status is " + httpResponse.getStatusText());
}
} catch (IOException x) {
// never mind, just log it
Log.warning(Geonet.CSW_HARVEST, "WARNING: " + x.getMessage() + " (this exception is swallowed)");
x.printStackTrace();