2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2017 AT&T Intellectual Property
6 * ===================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ============LICENSE_END=============================================
20 * ====================================================================
22 package org.onap.music.eelf.logging;
24 import java.io.IOException;
26 import javax.ws.rs.container.ContainerRequestContext;
27 import javax.ws.rs.container.ContainerResponseContext;
28 import javax.ws.rs.container.ContainerResponseFilter;
30 import org.springframework.stereotype.Component;
34 * This filter filter/modifies outbound http responses just before sending back to client.
40 public class MusicContainerFilter implements ContainerResponseFilter {
42 private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicContainerFilter.class);
44 public MusicContainerFilter() {
49 public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
51 if (null != EELFLoggerDelegate.mdcGet("transactionId")) {
52 EELFLoggerDelegate.mdcRemove("transactionId");
55 if (null != EELFLoggerDelegate.mdcGet("conversationId")) {
56 EELFLoggerDelegate.mdcRemove("conversationId");
59 if (null != EELFLoggerDelegate.mdcGet("clientId")) {
60 EELFLoggerDelegate.mdcRemove("clientId");
63 if (null != EELFLoggerDelegate.mdcGet("messageId")) {
64 EELFLoggerDelegate.mdcRemove("messageId");