From be4c967659e73814dc14d9c144b8ad4156af4aca Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Thu, 19 Oct 2023 11:54:55 +0200 Subject: Upgrade spring-boot to 2.4 - update spring-boot to latest available 2.4.X release - Content-Type's on GET requests now result in 415 (instead of being ignored) which necessitates changes to the ConfigurationTest Issue-ID: AAI-3667 Change-Id: If6cbce8185b443a79b5e3b32fa3ffede5cabee60 Signed-off-by: Fiete Ostkamp --- .../java/org/onap/aai/interceptors/post/InvalidResponseStatus.java | 5 +++-- .../org/onap/aai/interceptors/pre/RequestTransactionLogging.java | 2 +- .../src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'aai-resources/src/main/java/org') diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/post/InvalidResponseStatus.java b/aai-resources/src/main/java/org/onap/aai/interceptors/post/InvalidResponseStatus.java index 61ada79..1d20744 100644 --- a/aai-resources/src/main/java/org/onap/aai/interceptors/post/InvalidResponseStatus.java +++ b/aai-resources/src/main/java/org/onap/aai/interceptors/post/InvalidResponseStatus.java @@ -33,6 +33,7 @@ import javax.ws.rs.core.MediaType; import org.onap.aai.exceptions.AAIException; import org.onap.aai.interceptors.AAIContainerFilter; import org.onap.aai.logging.ErrorLogHelper; +import org.springframework.http.HttpStatus; @Priority(AAIResponseFilterPriority.INVALID_RESPONSE_STATUS) public class InvalidResponseStatus extends AAIContainerFilter implements ContainerResponseFilter { @@ -41,9 +42,9 @@ public class InvalidResponseStatus extends AAIContainerFilter implements Contain public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { - if (responseContext.getStatus() == 405) { + if (responseContext.getStatus() == HttpStatus.METHOD_NOT_ALLOWED.value()) { - responseContext.setStatus(400); + responseContext.setStatus(HttpStatus.BAD_REQUEST.value()); AAIException e = new AAIException("AAI_3012"); ArrayList templateVars = new ArrayList<>(); diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java index 14c1f01..2d0dcdc 100644 --- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java +++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java @@ -91,7 +91,7 @@ public class RequestTransactionLogging extends AAIContainerFilter implements Con requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE); } - if (WILDCARD.equals(acceptType) || StringUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) { + if (WILDCARD.equals(acceptType) || acceptType.isEmpty() || !StringUtils.hasLength(acceptType) || acceptType.contains(TEXT_PLAIN)) { UriInfo uriInfo = requestContext.getUriInfo(); if (uriInfo != null) { MultivaluedMap queryParameters = uriInfo.getQueryParameters(); diff --git a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java index 5208726..c685071 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java @@ -21,7 +21,6 @@ package org.onap.aai.rest; import io.micrometer.core.annotation.Timed; -import io.swagger.jaxrs.PATCH; import java.io.UnsupportedEncodingException; import java.net.URI; -- cgit 1.2.3-korg