dev #373
@ -45,6 +45,8 @@ public class InterfaceQsp {
|
|||||||
OutputStreamWriter osw = null;
|
OutputStreamWriter osw = null;
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
StringBuilder sb = null;
|
StringBuilder sb = null;
|
||||||
|
long startAt = System.currentTimeMillis();
|
||||||
|
String requestType = requestObject == null ? "none" : requestObject.getClass().getSimpleName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -60,6 +62,11 @@ public class InterfaceQsp {
|
|||||||
apiPath += "?" + queryString; // 쿼리 스트링 추가
|
apiPath += "?" + queryString; // 쿼리 스트링 추가
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug(
|
||||||
|
"QSP API call start: method={}, url={}, requestType={}",
|
||||||
|
httpMethod,
|
||||||
|
apiPath,
|
||||||
|
requestType);
|
||||||
url = new URL(apiPath);
|
url = new URL(apiPath);
|
||||||
con = (HttpURLConnection) url.openConnection();
|
con = (HttpURLConnection) url.openConnection();
|
||||||
con.setConnectTimeout(120000); // 서버에 연결되는 Timeout 시간 설정
|
con.setConnectTimeout(120000); // 서버에 연결되는 Timeout 시간 설정
|
||||||
@ -84,7 +91,8 @@ public class InterfaceQsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
int status = con.getResponseCode();
|
||||||
|
if (status == HttpURLConnection.HTTP_OK) {
|
||||||
br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"));
|
br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"));
|
||||||
|
|
||||||
String line;
|
String line;
|
||||||
@ -92,7 +100,19 @@ public class InterfaceQsp {
|
|||||||
sb.append(line);
|
sb.append(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.debug(
|
||||||
|
"QSP API call end: method={}, url={}, status={}, durationMs={}",
|
||||||
|
httpMethod,
|
||||||
|
apiPath,
|
||||||
|
status,
|
||||||
|
System.currentTimeMillis() - startAt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(
|
||||||
|
"QSP API call failed: method={}, url={}, durationMs={}",
|
||||||
|
httpMethod,
|
||||||
|
apiPath,
|
||||||
|
System.currentTimeMillis() - startAt,
|
||||||
|
e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
@ -166,8 +186,15 @@ public class InterfaceQsp {
|
|||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
|
|
||||||
byte[] bt = null;
|
byte[] bt = null;
|
||||||
|
long startAt = System.currentTimeMillis();
|
||||||
|
String requestType = requestObject == null ? "none" : requestObject.getClass().getSimpleName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
log.debug(
|
||||||
|
"QSP API call start: method={}, url={}, requestType={}",
|
||||||
|
httpMethod,
|
||||||
|
apiPath,
|
||||||
|
requestType);
|
||||||
url = new URL(apiPath);
|
url = new URL(apiPath);
|
||||||
con = (HttpURLConnection) url.openConnection();
|
con = (HttpURLConnection) url.openConnection();
|
||||||
con.setConnectTimeout(30000); // 서버에 연결되는 Timeout 시간 설정
|
con.setConnectTimeout(30000); // 서버에 연결되는 Timeout 시간 설정
|
||||||
@ -190,7 +217,8 @@ public class InterfaceQsp {
|
|||||||
osw.flush();
|
osw.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
int status = con.getResponseCode();
|
||||||
|
if (status == HttpURLConnection.HTTP_OK) {
|
||||||
// response 헤더 값 결과 셋팅
|
// response 헤더 값 결과 셋팅
|
||||||
result.put("type", con.getHeaderField("Content-Type"));
|
result.put("type", con.getHeaderField("Content-Type"));
|
||||||
result.put("disposition", con.getHeaderField("Content-Disposition"));
|
result.put("disposition", con.getHeaderField("Content-Disposition"));
|
||||||
@ -205,7 +233,19 @@ public class InterfaceQsp {
|
|||||||
}
|
}
|
||||||
bt = outputStream.toByteArray(); // 파일 데이터 반환
|
bt = outputStream.toByteArray(); // 파일 데이터 반환
|
||||||
}
|
}
|
||||||
|
log.debug(
|
||||||
|
"QSP API call end: method={}, url={}, status={}, durationMs={}",
|
||||||
|
httpMethod,
|
||||||
|
apiPath,
|
||||||
|
status,
|
||||||
|
System.currentTimeMillis() - startAt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(
|
||||||
|
"QSP API call failed: method={}, url={}, durationMs={}",
|
||||||
|
httpMethod,
|
||||||
|
apiPath,
|
||||||
|
System.currentTimeMillis() - startAt,
|
||||||
|
e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user