Skip to content
Snippets Groups Projects

Security

Merged Jitka Viceníková requested to merge security into develop
2 files
+ 6
6
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -8,11 +8,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.*;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.WebClientException;
import java.util.*;
@@ -39,7 +41,7 @@ public class CarComponentService extends DomainService<CarComponent> {
CarComponent savedComponent = repository.save(component);
try {
sendPostRequest(savedComponent);
} catch (RestClientException | IllegalArgumentException e) {
} catch (WebClientException e) {
log.debug(String.format("The notification module is not reachable on the URL: %s, exception %s", NOTIFICATION_MODULE_URL + NOTIFICATION_MODULE_URI, e));
}
return savedComponent;
@@ -79,10 +81,7 @@ public class CarComponentService extends DomainService<CarComponent> {
.contentType(MediaType.APPLICATION_JSON)
.bodyValue(notification)
.retrieve()
.bodyToMono(new ParameterizedTypeReference<Map<String, Object>>() {})
.doOnError(error -> {
throw new RestClientException("Failed to send POST request", error);
})
.bodyToMono(Resource.class)
.block();
}
}
Loading