body전문 없는 variablepath 및 예외처리 추가

This commit is contained in:
cho
2026-02-19 15:53:43 +09:00
parent 349e12f23d
commit d1aaff22ac
3 changed files with 35 additions and 29 deletions
@@ -94,6 +94,7 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
transactionProp.put(INBOUND_METHOD, request.getMethod()); transactionProp.put(INBOUND_METHOD, request.getMethod());
transactionProp.put(INBOUND_URI, request.getRequestURI()); transactionProp.put(INBOUND_URI, request.getRequestURI());
transactionProp.put(INBOUND_HEADER, getHeaders(request)); transactionProp.put(INBOUND_HEADER, getHeaders(request));
transactionProp.put(INBOUND_EXTPARAMS, StringUtils.defaultString(request.getQueryString()));
if (StringUtils.equals(adapterVO.getAdapterGroupVO().getType(), Keys.TYPE_REST) if (StringUtils.equals(adapterVO.getAdapterGroupVO().getType(), Keys.TYPE_REST)
|| StringUtils.equals(adapterVO.getAdapterGroupVO().getType(), Keys.TYPE_HTTP_CUSTOM)) { || StringUtils.equals(adapterVO.getAdapterGroupVO().getType(), Keys.TYPE_HTTP_CUSTOM)) {
// /api/v1/public/getUserInfo.svc // /api/v1/public/getUserInfo.svc
@@ -207,35 +208,37 @@ public class ApiAdapterService extends HttpAdapterServiceSupport {
logger.debug("HttpAdapterServiceRest] RECV (" + adptGrpName + ") = [" + paramValue + "]\n" logger.debug("HttpAdapterServiceRest] RECV (" + adptGrpName + ") = [" + paramValue + "]\n"
+ CommonLib.getDumpMessage(paramValue.getBytes(encode))); + CommonLib.getDumpMessage(paramValue.getBytes(encode)));
} }
} else { } else {
ServletInputStream sis = request.getInputStream(); if (request.getContentLength() > 0) {
ByteBuffer bb = ByteBuffer.allocate(1024).setAutoExpand(true); ServletInputStream sis = request.getInputStream();
int i = 0; ByteBuffer bb = ByteBuffer.allocate(1024).setAutoExpand(true);
byte[] cbuf = new byte[1024]; int i = 0;
while ((i = sis.read(cbuf, 0, 1024)) != -1) { byte[] cbuf = new byte[1024];
if (i == 1024) { while ((i = sis.read(cbuf, 0, 1024)) != -1) {
bb.put(cbuf); if (i == 1024) {
} else { bb.put(cbuf);
byte[] tail = new byte[i]; } else {
System.arraycopy(cbuf, 0, tail, 0, i); byte[] tail = new byte[i];
bb.put(tail); System.arraycopy(cbuf, 0, tail, 0, i);
} bb.put(tail);
} }
byte[] data = new byte[bb.position()]; }
bb.position(0); byte[] data = new byte[bb.position()];
bb.get(data); bb.position(0);
paramValue = new String(data, encode); bb.get(data);
paramValue = new String(data, encode);
if (traceLevel >= 3) { if (traceLevel >= 3) {
HttpMemoryLogger.txlog(adptGrpName + adptName, HttpMemoryLogger.txlog(adptGrpName + adptName,
"RECV " + "[" + paramValue + "]" + CommonLib.getDumpMessage(data)); "RECV " + "[" + paramValue + "]" + CommonLib.getDumpMessage(data));
} }
if (logger.isDebug()) { if (logger.isDebug()) {
logger.debug("HttpAdapterServiceRest] RECV (" + adptGrpName + ") = [" + paramValue + "]\n" logger.debug("HttpAdapterServiceRest] RECV (" + adptGrpName + ") = [" + paramValue + "]\n"
+ CommonLib.getDumpMessage(data)); + CommonLib.getDumpMessage(data));
} }
} }
}
if (paramValue == null) { // parameter가 없는 경우때문에 처리 if (paramValue == null) { // parameter가 없는 경우때문에 처리
paramValue = ""; paramValue = "";
@@ -312,6 +312,7 @@ public class HttpAdapterServiceVirtualAccount extends HttpAdapterServiceSupport
prop.put(INBOUND_METHOD, request.getMethod()); prop.put(INBOUND_METHOD, request.getMethod());
prop.put(INBOUND_URI, request.getRequestURI()); prop.put(INBOUND_URI, request.getRequestURI());
prop.put(INBOUND_HEADER, getHeaders(request)); prop.put(INBOUND_HEADER, getHeaders(request));
prop.put(INBOUND_EXTPARAMS, StringUtils.defaultString(request.getQueryString()));
if (StringUtils.equals(adptVO.getAdapterGroupVO().getType(), Keys.TYPE_REST) if (StringUtils.equals(adptVO.getAdapterGroupVO().getType(), Keys.TYPE_REST)
|| StringUtils.equals(adptVO.getAdapterGroupVO().getType(), Keys.TYPE_HTTP_CUSTOM)) { || StringUtils.equals(adptVO.getAdapterGroupVO().getType(), Keys.TYPE_HTTP_CUSTOM)) {
// /api/v1/public/getUserInfo.svc // /api/v1/public/getUserInfo.svc
@@ -18,7 +18,9 @@ public class SimpleframeworkBodyFilter extends SimpleFrameworkFilter {
if ( returnMessage instanceof String ) { if ( returnMessage instanceof String ) {
bizJsonStr = (JSONObject) JSONValue.parse( (String)returnMessage); bizJsonStr = (JSONObject) JSONValue.parse( (String)returnMessage);
bizJsonStr.put("GUID", tempProp.get(TransactionContextKeys.GUID)); if( bizJsonStr != null ) {
bizJsonStr.put("GUID", tempProp.getOrDefault(TransactionContextKeys.GUID, "") );
}
} }
return bizJsonStr != null ? bizJsonStr.toJSONString() : returnMessage; return bizJsonStr != null ? bizJsonStr.toJSONString() : returnMessage;