feat: KT API 반영

dev
Jonguk. Lim 1 year ago
parent 2947ac5d57
commit 9c7e34143e

@ -163,6 +163,7 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(paramDTO.getSignguCode(), paramDTO.getFfnlgCode());
final KtTokenRequest reqDTO = KtTokenRequest.builder()
.clientId(ktMnsInfo.getKtClientId())
//.clientId(ktMnsInfo.getKtSvcClientId())
.clientSecret(ktMnsInfo.getKtSvcClientSecret())
.scope(ktMnsInfo.getKtScope())
.build();
@ -173,9 +174,8 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
// headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
// headerMap.put("client-id", "client-id");
// headerMap.put("client-tp", "10");
headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, "access-token"));
// headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, "access-token"));
//try {
return webClient.exchange(
HOST + API_GENERATE_TOKEN,
HttpMethod.POST,

@ -3,7 +3,6 @@ package kr.xit.ens.kt.web;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.cmm.service.ICmmEnsCacheService;
import kr.xit.biz.ens.model.kt.KtAcmdDTO;
import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfRequest;
import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfResponse;
import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdInfoRequest;

@ -425,6 +425,14 @@
</dependency>
<!-- cache: caffeine -->
<!-- MacOS DNS resolver error -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-aarch_64</classifier>
</dependency>
<!-- MacOS DNS resolver error -->
</dependencies>
<build>

@ -75,10 +75,10 @@ public class WebClientConfig {
.clientConnector(new ReactorClientHttpConnector(defaultHttpClient()))
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024))
.exchangeStrategies(defaultExchangeStrategies())
// .filters(exchangeFilterFunctions -> {
// exchangeFilterFunctions.add(requestFilter());
// exchangeFilterFunctions.add(responseFilter());
// })
.filters(exchangeFilterFunctions -> {
exchangeFilterFunctions.add(requestFilter());
exchangeFilterFunctions.add(responseFilter());
})
.build();
}
@ -136,9 +136,10 @@ public class WebClientConfig {
private ExchangeFilterFunction requestFilter() {
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("\n>>>>>>>>>> Http Rest Request <<<<<<<<<<<<<\n");
StringBuilder sb = new StringBuilder("\n>>>>>>>>>> WebClient Http Request <<<<<<<<<<<<<\n");
sb.append(logMethodAndUrl(clientRequest));
sb.append(logHeaders(clientRequest));
sb.append("-------------------------------------------------------");
log.debug(sb.toString());
}
return Mono.just(clientRequest);
@ -165,9 +166,10 @@ public class WebClientConfig {
if(log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder(
"\n>>>>>>>>>> Http Rest Response <<<<<<<<<<<<<\n");
"\n>>>>>>>>>> WebClient Http Response <<<<<<<<<<<<<\n");
sb.append(logStatus(clientResponse));
sb.append(logHeaders(clientResponse));
sb.append("-------------------------------------------------------");
log.debug(sb.toString());
return logBody(clientResponse);
}
@ -193,21 +195,20 @@ public class WebClientConfig {
}
}
private static String logHeaders(ClientResponse response) {
private static String logHeaders(ClientRequest request) {
StringBuilder sb = new StringBuilder();
response.headers()
.asHttpHeaders()
.forEach((name, values) ->
values.forEach(value -> sb.append(name).append(": ").append(value).append("\n"))
);
request.headers()
.forEach((name, values) ->
values.forEach(value -> sb.append(name).append(": ").append(value).append("\n"))
);
return sb.toString();
}
private static String logHeaders(ClientRequest request) {
private static String logHeaders(ClientResponse response) {
StringBuilder sb = new StringBuilder();
request.headers()
response.headers()
.asHttpHeaders()
.forEach((name, values) ->
values.forEach(value -> sb.append(name).append(": ").append(value).append("\n"))
);

Loading…
Cancel
Save