diff options
author | Steve Smokowski <ss835w@att.com> | 2020-10-22 15:14:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-10-22 15:14:52 +0000 |
commit | 66ee1cc378b5a93a4ca225fe5bf31729cf762ffd (patch) | |
tree | 4bb903ff93240020f6363f41372bc6f6f0f85140 /common | |
parent | e343c3d7c55e841f85de58ed0dc8f4650d356715 (diff) | |
parent | 7a2c68f4a2a0d297749bda79d2697de468c9cf6d (diff) |
Merge "so does not capture the vnf name"
Diffstat (limited to 'common')
-rw-r--r-- | common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java | 18 |
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)); + } } |