Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 46d88d77f2 | |||
| 51967284ba | |||
| a218291748 |
@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import com.eactive.eai.adapter.http.dynamic.filter.HttpAdapterFilter;
|
import com.eactive.eai.adapter.http.dynamic.filter.HttpAdapterFilter;
|
||||||
import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException;
|
import com.eactive.eai.adapter.http.dynamic.filter.JwtAuthException;
|
||||||
@@ -48,7 +49,7 @@ public class ApiKeyExtractFilter implements HttpAdapterFilter {
|
|||||||
// PathVariable 지원 추가
|
// PathVariable 지원 추가
|
||||||
String ruledPath = getMatchedKey(requestPath);
|
String ruledPath = getMatchedKey(requestPath);
|
||||||
if(ruledPath == null)
|
if(ruledPath == null)
|
||||||
throw new IllegalAccessException("path not found - " + requestPath);
|
throw new FilterException("path not found - " + requestPath, ERROR_PRE_FAIL, HttpStatus.FORBIDDEN.value());
|
||||||
prop.setProperty(FINAL_STD_MESSAGE_KEY, ruledPath);// StandardMessageUtil.getMatchedKey(), url
|
prop.setProperty(FINAL_STD_MESSAGE_KEY, ruledPath);// StandardMessageUtil.getMatchedKey(), url
|
||||||
// pathvariable도 처리
|
// pathvariable도 처리
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
public interface HttpAdapterFilter {
|
public interface HttpAdapterFilter {
|
||||||
|
|
||||||
|
public static final String ERROR_PRE_FAIL = "E.PREFILTER_FAIL";
|
||||||
|
public static final String ERROR_POST_FAIL = "E.POSTFILTER_FAIL";
|
||||||
|
|
||||||
public Object doPreFilter(String adptGrpName, String adptName, Object message, Properties prop,
|
public Object doPreFilter(String adptGrpName, String adptName, Object message, Properties prop,
|
||||||
HttpServletRequest request, HttpServletResponse response) throws Exception;
|
HttpServletRequest request, HttpServletResponse response) throws Exception;
|
||||||
|
|
||||||
|
|||||||
@@ -694,35 +694,37 @@ public class RESTProcess extends HTTPProcess {
|
|||||||
public void setOutboundErrorMessage() throws Exception {
|
public void setOutboundErrorMessage() throws Exception {
|
||||||
this.logPssSno = TranLogUtil.getResLogSeq(this.svcPssTp, this.svcPssSeq, this.isComp);
|
this.logPssSno = TranLogUtil.getResLogSeq(this.svcPssTp, this.svcPssSeq, this.isComp);
|
||||||
|
|
||||||
|
boolean setResObject = false;
|
||||||
// 에러에 대한 응답메시지
|
// 에러에 대한 응답메시지
|
||||||
if(this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP) instanceof Map) {
|
if(this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP) instanceof Map) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Map<String, Object> map = (Map<String, Object>) this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP);
|
Map<String, Object> map = (Map<String, Object>) this.tempProp.get(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP);
|
||||||
this.callProp.put(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP, map);
|
this.callProp.put(HttpAdapterServiceKey.OUTBOUND_PROPERTY_MAP, map);
|
||||||
}
|
|
||||||
|
|
||||||
boolean setResObject = false;
|
|
||||||
AdapterGroupVO outboundAdapterGroupVO = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
|
||||||
if (outboundAdapterGroupVO != null) {
|
|
||||||
AdapterVO outboundAdapterVo = null;
|
|
||||||
if(adapterName != null)
|
|
||||||
outboundAdapterVo = outboundAdapterGroupVO.getAdapterVO(adapterName);
|
|
||||||
else
|
|
||||||
outboundAdapterVo = outboundAdapterGroupVO.nextAdapterVO();
|
|
||||||
|
|
||||||
if (outboundAdapterVo != null) {
|
// OUTBOUND_PROPERTY_MAP 이 있는 경우, 즉 타겟서버와 통신은 정상적으로 이루진 경우 처리한다.
|
||||||
String errorHandlerClass = AdapterPropManager.getInstance().getProperty(
|
AdapterGroupVO outboundAdapterGroupVO = AdapterManager.getInstance().getAdapterGroupVO(adapterGroupName);
|
||||||
outboundAdapterVo.getPropGroupName(), "ERR_MSG_HANDLER");
|
if (outboundAdapterGroupVO != null) {
|
||||||
if (StringUtils.isNotBlank(errorHandlerClass)) {
|
AdapterVO outboundAdapterVo = null;
|
||||||
if (logger.isInfo())
|
if(adapterName != null)
|
||||||
logger.info("ExceptionHandler] errorSyncSend ERR_MSG_HANDLER=" + errorHandlerClass);
|
outboundAdapterVo = outboundAdapterGroupVO.getAdapterVO(adapterName);
|
||||||
AdapterErrorMessageHandler handler = AdapterErrorMessageHandlerFactory.createHandler(errorHandlerClass);
|
else
|
||||||
this.resObject = handler.generateOutboundErrorResponseMessage(adapterGroupName, adapterGroupName,
|
outboundAdapterVo = outboundAdapterGroupVO.nextAdapterVO();
|
||||||
callProp, this.reqObject, this.resEaiMsg);
|
|
||||||
setResObject = true;
|
if (outboundAdapterVo != null) {
|
||||||
|
String errorHandlerClass = AdapterPropManager.getInstance().getProperty(
|
||||||
|
outboundAdapterVo.getPropGroupName(), "ERR_MSG_HANDLER");
|
||||||
|
if (StringUtils.isNotBlank(errorHandlerClass)) {
|
||||||
|
if (logger.isInfo())
|
||||||
|
logger.info("ExceptionHandler] errorSyncSend ERR_MSG_HANDLER=" + errorHandlerClass);
|
||||||
|
AdapterErrorMessageHandler handler = AdapterErrorMessageHandlerFactory.createHandler(errorHandlerClass);
|
||||||
|
this.resObject = handler.generateOutboundErrorResponseMessage(adapterGroupName, adapterGroupName,
|
||||||
|
callProp, this.reqObject, this.resEaiMsg);
|
||||||
|
setResObject = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!setResObject) {
|
if (!setResObject) {
|
||||||
this.resObject = "";
|
this.resObject = "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user