aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2020-10-21 11:29:18 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-10-21 11:29:19 -0400
commit7a2c68f4a2a0d297749bda79d2697de468c9cf6d (patch)
treecd196cb4d877d22831b71b1ef4ddab7256f2ac1a /common
parent623dbe5cf31cec13c3c6eec7b74791682eb3b731 (diff)
so does not capture the vnf name
Add requestid to return headers to audit filter Added catch for exceptions from validators Removed unused test file Updated validation unit test Updated transactionId header assertion in failing test Updated assertion as validator order changes Updated assertions to check for requestId Issue-ID: SO-3325 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I246d9e371346639b4c4ea2b99add1d891af96b8e
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
index 9552755544..85925e2725 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
@@ -2,13 +2,16 @@ package org.onap.so.logging.jaxrs.filter;
import javax.annotation.Priority;
import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.PreMatching;
+import javax.ws.rs.core.MultivaluedMap;
+import org.onap.logging.filter.base.AuditLogContainerFilter;
+import org.onap.logging.filter.base.Constants;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.logger.LogConstants;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
-import org.onap.logging.filter.base.AuditLogContainerFilter;
@Priority(1)
@PreMatching
@@ -27,4 +30,17 @@ public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
}
MDC.put(LogConstants.URI_BASE, request.getUriInfo().getBaseUri().toString());
}
+
+ @Override
+ protected void additionalPostHandling(ContainerResponseContext response) {
+ MultivaluedMap<String, Object> responseHeaders = response.getHeaders();
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ responseHeaders.add(ONAPLogConstants.Headers.REQUEST_ID, requestId);
+ responseHeaders.add(Constants.HttpHeaders.HEADER_REQUEST_ID, requestId);
+ responseHeaders.add(Constants.HttpHeaders.TRANSACTION_ID, requestId);
+ responseHeaders.add(Constants.HttpHeaders.ECOMP_REQUEST_ID, requestId);
+ responseHeaders.add(ONAPLogConstants.Headers.PARTNER_NAME, getProperty(Constants.Property.PARTNER_NAME));
+ responseHeaders.add(ONAPLogConstants.Headers.INVOCATION_ID,
+ MDC.get(ONAPLogConstants.MDCs.SERVER_INVOCATION_ID));
+ }
}