비동기 일때 더미응답 처리 수정.
This commit is contained in:
+4
-1
@@ -198,12 +198,15 @@ public class HttpAdapterServiceStandard extends HttpAdapterServiceSupport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null) {
|
if ( result == null) {
|
||||||
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName);
|
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName);
|
||||||
} else if (result instanceof byte[]) {
|
} else if (result instanceof byte[]) {
|
||||||
responseData = new String((byte[]) result, encode);
|
responseData = new String((byte[]) result, encode);
|
||||||
} else if (result instanceof String) {
|
} else if (result instanceof String) {
|
||||||
responseData = (String) result;
|
responseData = (String) result;
|
||||||
|
if ( StringUtils.isBlank( responseData ) ) {
|
||||||
|
responseData = ElinkConfig.getAsyncDummyDataForAdapterGroup(adptGrpName, adptName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
response.setCharacterEncoding(encode);
|
response.setCharacterEncoding(encode);
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.eactive.eai.env;
|
package com.eactive.eai.env;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
@@ -13,6 +16,8 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||||
import com.eactive.eai.adapter.AdapterManager;
|
import com.eactive.eai.adapter.AdapterManager;
|
||||||
|
import com.eactive.eai.adapter.AdapterPropManager;
|
||||||
|
import com.eactive.eai.adapter.AdapterVO;
|
||||||
import com.eactive.eai.common.dao.DAOException;
|
import com.eactive.eai.common.dao.DAOException;
|
||||||
import com.eactive.eai.common.util.ContainerUtil;
|
import com.eactive.eai.common.util.ContainerUtil;
|
||||||
|
|
||||||
@@ -297,6 +302,47 @@ public class ElinkConfig implements ConfigKeys {
|
|||||||
}
|
}
|
||||||
return getAsyncDummyData(adptrMsgPtrnCd);
|
return getAsyncDummyData(adptrMsgPtrnCd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getAsyncDummyDataForAdapterGroup(String adapterGroupName, String adapterName) {
|
||||||
|
|
||||||
|
Properties httpProp = null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
AdapterVO adapterVO = AdapterManager.getInstance().getAdapterVO(adapterGroupName, adapterName);
|
||||||
|
|
||||||
|
httpProp = AdapterPropManager.getInstance().getProperties(adapterVO.getPropGroupName());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return makeResponseBodyMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
String asyncMsgStyle = httpProp.getProperty("ASYNC_RTNMSG_TYPE", "").toUpperCase();
|
||||||
|
String responseBody ="";
|
||||||
|
if (asyncMsgStyle == null || asyncMsgStyle.trim().isEmpty()) {
|
||||||
|
responseBody = makeResponseBodyMsg();
|
||||||
|
} else {
|
||||||
|
responseBody = asyncMsgStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
static private String makeResponseBodyMsg() {
|
||||||
|
|
||||||
|
Map<String, Object> dataMap = new HashMap<>();
|
||||||
|
dataMap.put("result", 1);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
map.put("code", "200");
|
||||||
|
map.put("data", dataMap);
|
||||||
|
map.put("message", "정상 처리 되었습니다.");
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.putAll(map);
|
||||||
|
|
||||||
|
return json.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
public static String getHttpClientUrlReplaceName() {
|
public static String getHttpClientUrlReplaceName() {
|
||||||
return httpClientUrlReplaceName;
|
return httpClientUrlReplaceName;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user