Skip to content
Snippets Groups Projects

Security

Merged Jitka Viceníková requested to merge security into develop
3 files
+ 11
12
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -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.RestClientException;
import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.web.reactive.function.client.WebClientException;
import java.time.LocalDate;
import java.util.HashMap;
@@ -62,7 +64,7 @@ public class ApplicationService {
try {
sendPostRequest(savedApplication, NOTIFICATION_MODULE_URI_NEW, List.of(savedApplication.getEmail()));
} 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_NEW, e));
}
@@ -89,7 +91,7 @@ public class ApplicationService {
if (savedApplication.getStatus() != ApplicationStatusEnum.PENDING) {
try {
sendPostRequest(savedApplication, NOTIFICATION_MODULE_URI_STATUS, NOTIFICATION_RECEIVERS);
} 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_STATUS, e));
}
}
@@ -107,10 +109,7 @@ public class ApplicationService {
.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