http 레거시 타입 Inbound 메세지 타입 JSON일때,
json 에러 메세지 나가도록 수정.
This commit is contained in:
+40
-12
@@ -1,5 +1,6 @@
|
||||
package com.eactive.eai.adapter.http.dynamic.impl;
|
||||
|
||||
import com.eactive.eai.adapter.AdapterGroupVO;
|
||||
import com.eactive.eai.adapter.AdapterManager;
|
||||
import com.eactive.eai.adapter.AdapterPropManager;
|
||||
import com.eactive.eai.adapter.AdapterVO;
|
||||
@@ -53,10 +54,13 @@ public class HttpAdapterServiceStandard extends HttpAdapterServiceSupport
|
||||
**/
|
||||
public void service(String adptGrpName, String adptName, HttpServletRequest request, HttpServletResponse response) {
|
||||
int traceLevel = 0;
|
||||
|
||||
AdapterGroupVO adapterGroupVo = null;
|
||||
|
||||
try {
|
||||
AdapterManager adapterManager = AdapterManager.getInstance();
|
||||
AdapterVO adptVO = adapterManager.getAdapterVO(adptGrpName,adptName);
|
||||
|
||||
adapterGroupVo = adptVO.getAdapterGroupVO();
|
||||
AdapterPropManager manager = AdapterPropManager.getInstance();
|
||||
|
||||
if(adptVO == null) {
|
||||
@@ -257,25 +261,49 @@ public class HttpAdapterServiceStandard extends HttpAdapterServiceSupport
|
||||
}
|
||||
logger.warn("HttpAdapter] " + adptGrpName + "-" + adptName + ">>" + e.getMessage());
|
||||
response.setStatus(e.getStatus());
|
||||
try {
|
||||
String errorMsg = String.format("(%d) %s", e.getStatus(), e.getMessage());
|
||||
response.getWriter().println(errorMsg);
|
||||
} catch (Exception ex) {
|
||||
// IGNORE
|
||||
|
||||
if( "JSN".equals( adapterGroupVo.getMessageType() ) ) {
|
||||
try {
|
||||
String errorMsg = MessageUtil.makeJsonErrorMessage( MessageUtil.ERROR_CODE_AP_ERROR, e.getMessage());
|
||||
response.getWriter().println(errorMsg);
|
||||
} catch (Exception ex) {
|
||||
// IGNORE
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
String errorMsg = String.format("(%d) %s", e.getStatus(), e.getMessage());
|
||||
response.getWriter().println(errorMsg);
|
||||
} catch (Exception ex) {
|
||||
// IGNORE
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (traceLevel >= 3){
|
||||
HttpMemoryLogger.error(adptGrpName+adptName, e.toString(),e);
|
||||
}
|
||||
logger.error("HttpAdapter] "+adptGrpName+"-"+adptName, e);
|
||||
response.setStatus(500);
|
||||
try {
|
||||
response.getWriter().println(e.getMessage());
|
||||
String errCode = ExceptionUtil.getErrorCode(e, "RECEAIAHA003");
|
||||
throw new Exception(errCode);
|
||||
} catch (Exception ex) {
|
||||
logger.warn("error", ex);
|
||||
|
||||
if( "JSN".equals( adapterGroupVo.getMessageType() ) ) {
|
||||
try {
|
||||
String errorMsg = MessageUtil.makeJsonErrorMessage( MessageUtil.ERROR_CODE_AP_ERROR, e.getMessage());
|
||||
response.getWriter().println(errorMsg);
|
||||
throw new Exception(MessageUtil.ERROR_CODE_AP_ERROR);
|
||||
} catch (Exception ex) {
|
||||
logger.warn("error", ex);
|
||||
}
|
||||
}else {
|
||||
try {
|
||||
response.getWriter().println(e.getMessage());
|
||||
String errCode = ExceptionUtil.getErrorCode(e, "RECEAIAHA003");
|
||||
throw new Exception(errCode);
|
||||
} catch (Exception ex) {
|
||||
logger.warn("error", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user