properties 처리 수정
This commit is contained in:
+30
-11
@@ -6,8 +6,6 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
import com.eactive.eai.adapter.http.dynamic.HttpAdapterServiceKey;
|
||||||
import com.eactive.eai.common.TransactionContextKeys;
|
import com.eactive.eai.common.TransactionContextKeys;
|
||||||
import com.eactive.eai.common.property.PropGroupVO;
|
|
||||||
import com.eactive.eai.common.property.PropManager;
|
|
||||||
import com.eactive.eai.common.util.Logger;
|
import com.eactive.eai.common.util.Logger;
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +20,6 @@ public class AsyncReponseFilter implements HttpClientAdapterFilter, HttpAdapterS
|
|||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
logger.debug("AsyncReponseFilter] PreFilter Processing Start!!");
|
logger.debug("AsyncReponseFilter] PreFilter Processing Start!!");
|
||||||
Object returnMessage = message;
|
|
||||||
String traceId = tempProp.getProperty(TransactionContextKeys.TRANSACTION_UUID, "");
|
String traceId = tempProp.getProperty(TransactionContextKeys.TRANSACTION_UUID, "");
|
||||||
|
|
||||||
Properties filterHeaders = (Properties) tempProp.get("FILTERHEADER");
|
Properties filterHeaders = (Properties) tempProp.get("FILTERHEADER");
|
||||||
@@ -31,13 +28,7 @@ public class AsyncReponseFilter implements HttpClientAdapterFilter, HttpAdapterS
|
|||||||
tempProp.put("FILTERHEADER", filterHeaders);
|
tempProp.put("FILTERHEADER", filterHeaders);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Properties inboundHeader = (Properties)tempProp.get(INBOUND_HEADER);
|
Map<String, String> inboundHeaderMap = getInboundHeaderProp(tempProp);
|
||||||
Map<String, String> inboundHeaderMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
// Properties 내용을 모두 복사
|
|
||||||
for (String name : inboundHeader.stringPropertyNames()) {
|
|
||||||
inboundHeaderMap.put(name, inboundHeader.getProperty(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inboundHeaderMap.isEmpty()) {
|
if (!inboundHeaderMap.isEmpty()) {
|
||||||
if (inboundHeaderMap.containsKey(X_TRACE_ID)) {
|
if (inboundHeaderMap.containsKey(X_TRACE_ID)) {
|
||||||
@@ -52,7 +43,35 @@ public class AsyncReponseFilter implements HttpClientAdapterFilter, HttpAdapterS
|
|||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnMessage;
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getInboundHeaderProp(Properties prop) {
|
||||||
|
Properties header = new Properties();
|
||||||
|
Map<String, String> inboundHeaderMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
try {
|
||||||
|
Object headerObj = prop.get(HttpAdapterServiceKey.INBOUND_HEADER);
|
||||||
|
if (headerObj instanceof Properties) { //tomcat
|
||||||
|
header = (Properties) headerObj;
|
||||||
|
for (String name : header.stringPropertyNames()) {
|
||||||
|
inboundHeaderMap.put(name, header.getProperty(name));
|
||||||
|
}
|
||||||
|
} else if (headerObj instanceof String) { //weblogic
|
||||||
|
String str = (String) headerObj;
|
||||||
|
str = str.substring(1, str.length() - 1);
|
||||||
|
// key=value 쌍 분리
|
||||||
|
String[] entries = str.split(",");
|
||||||
|
for (String entry : entries) {
|
||||||
|
String[] kv = entry.split("=", 2);
|
||||||
|
if (kv.length == 2) {
|
||||||
|
inboundHeaderMap.put(kv[0].trim(), kv[1].trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return inboundHeaderMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user