Relay 헤더값 프로퍼티 동적으로 조정 가능하도록 수정.
This commit is contained in:
+27
@@ -1,11 +1,15 @@
|
||||
package com.eactive.eai.custom.kjb.adapter.http.client.filter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
||||
import com.eactive.eai.common.TransactionContextKeys;
|
||||
import com.eactive.eai.common.property.PropManager;
|
||||
import com.eactive.eai.common.util.Logger;
|
||||
|
||||
|
||||
@@ -15,6 +19,9 @@ public class AsyncReponseFilter implements HttpClientAdapterFilter, HttpAdapterS
|
||||
public static final String X_TRACE_ID = "partnerTraceId";
|
||||
public static final String TRACE_ID = "traceId";
|
||||
|
||||
public static final String PROPERTIES_GROUP_NAME = "HttpHeaderFilter";
|
||||
public static final String HEADER_KEY_NAMES = "AsyncReponseFilter";
|
||||
|
||||
|
||||
@Override
|
||||
public Object doPreFilter(String adptGrpName, String adptName, Properties prop, Object message, Properties tempProp)
|
||||
@@ -28,6 +35,16 @@ public class AsyncReponseFilter implements HttpClientAdapterFilter, HttpAdapterS
|
||||
filterHeaders = new Properties();
|
||||
tempProp.put("FILTERHEADER", filterHeaders);
|
||||
}
|
||||
|
||||
String propValue = PropManager.getInstance().getProperty(PROPERTIES_GROUP_NAME, HEADER_KEY_NAMES, "").trim();
|
||||
|
||||
String[] headerKeyNames = propValue.split(",");
|
||||
|
||||
|
||||
headerKeyNames = Arrays.stream(headerKeyNames)
|
||||
.map(String::trim)
|
||||
.toArray(String[]::new);
|
||||
|
||||
try {
|
||||
Map<String, String> inboundHeaderMap = getInboundHeaderProp(tempProp);
|
||||
|
||||
@@ -45,6 +62,16 @@ public class AsyncReponseFilter implements HttpClientAdapterFilter, HttpAdapterS
|
||||
|
||||
filterHeaders.setProperty(TRACE_ID, traceId);
|
||||
logger.debug("AsyncReponseFilter] Processing Key ["+TRACE_ID+"], value ["+traceId+"]");
|
||||
|
||||
for (String keyName : inboundHeaderMap.keySet()) {
|
||||
|
||||
if (StringUtils.equalsAnyIgnoreCase(keyName, headerKeyNames)) {
|
||||
String value = inboundHeaderMap.get(keyName);
|
||||
filterHeaders.put(keyName, value);
|
||||
logger.debug("AsyncReponseFilter] Processing Key [" + keyName + "], value [" + value + "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user