summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/filter/PromiseRequestIdFilter.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt24
2 files changed, 12 insertions, 20 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/filter/PromiseRequestIdFilter.java b/vid-app-common/src/main/java/org/onap/vid/controller/filter/PromiseRequestIdFilter.java
index c0fc96e03..ac93d8751 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/filter/PromiseRequestIdFilter.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/filter/PromiseRequestIdFilter.java
@@ -58,12 +58,6 @@ public class PromiseRequestIdFilter extends GenericFilterBean {
private static final Pattern uuidRegex = Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", Pattern.CASE_INSENSITIVE);
- private final Headers headers;
-
- public PromiseRequestIdFilter(Headers headers) {
- this.headers = headers;
- }
-
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
@@ -118,7 +112,7 @@ public class PromiseRequestIdFilter extends GenericFilterBean {
}
String highestPriorityHeader(HttpServletRequest httpRequest) {
- return defaultIfNull(headers.highestPriorityHeader(httpRequest), PROMISED_HEADER_NAME);
+ return defaultIfNull(Headers.highestPriorityHeader(httpRequest), PROMISED_HEADER_NAME);
}
private static class PromiseRequestIdRequestWrapper extends HttpServletRequestWrapper {
diff --git a/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt b/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt
index cc5ebf38c..e710fd973 100644
--- a/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/logging/Headers.kt
@@ -1,20 +1,18 @@
+@file:JvmName("Headers")
+
package org.onap.vid.logging
import org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID
-import org.springframework.stereotype.Component
import javax.servlet.http.HttpServletRequest
-@Component
-class Headers {
- fun prioritizedRequestIdHeaders() = listOf(
- "X-ONAP-RequestID",
- "X-RequestID",
- "X-TransactionID",
- ECOMP_REQUEST_ID
- )
+fun prioritizedRequestIdHeaders() = listOf(
+ "X-ONAP-RequestID",
+ "X-RequestID",
+ "X-TransactionID",
+ ECOMP_REQUEST_ID
+)
- fun highestPriorityHeader(httpRequest: HttpServletRequest): String? {
- val headers = httpRequest.headerNames.asSequence().toSet().map { it.toUpperCase() }
- return prioritizedRequestIdHeaders().firstOrNull { headers.contains(it.toUpperCase()) }
- }
+fun highestPriorityHeader(httpRequest: HttpServletRequest): String? {
+ val headers = httpRequest.headerNames.asSequence().toSet().map { it.toUpperCase() }
+ return prioritizedRequestIdHeaders().firstOrNull { headers.contains(it.toUpperCase()) }
}