API 요청시 로그 추가
This commit is contained in:
@@ -17,6 +17,7 @@ public class ApiClientFactory {
|
|||||||
public ApiClient getClient(ApiRequestDTO request) {
|
public ApiClient getClient(ApiRequestDTO request) {
|
||||||
switch (request.getType().toUpperCase()) {
|
switch (request.getType().toUpperCase()) {
|
||||||
case "HTTP":
|
case "HTTP":
|
||||||
|
case "HTTPFLAT":
|
||||||
return httpApiClient;
|
return httpApiClient;
|
||||||
case "TCP":
|
case "TCP":
|
||||||
return tcpApiClient;
|
return tcpApiClient;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public class NettyHttpApiClient implements ApiClient {
|
|||||||
ch.pipeline().addLast(new HttpClientCodec());
|
ch.pipeline().addLast(new HttpClientCodec());
|
||||||
ch.pipeline().addLast(new HttpObjectAggregator(65536));
|
ch.pipeline().addLast(new HttpObjectAggregator(65536));
|
||||||
ch.pipeline().addLast(new HttpContentDecompressor());
|
ch.pipeline().addLast(new HttpContentDecompressor());
|
||||||
|
ch.pipeline().addLast(new HttpRequestLoggerHandler()); // Add custom HttpRequestLoggerHandler
|
||||||
ch.pipeline().addLast(new HttpHandler(responseFuture));
|
ch.pipeline().addLast(new HttpHandler(responseFuture));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -92,8 +93,7 @@ public class NettyHttpApiClient implements ApiClient {
|
|||||||
if (queryIndex != -1) {
|
if (queryIndex != -1) {
|
||||||
String path = fullPath.substring(0, queryIndex);
|
String path = fullPath.substring(0, queryIndex);
|
||||||
String queryParams = fullPath.substring(queryIndex + 1);
|
String queryParams = fullPath.substring(queryIndex + 1);
|
||||||
String encodedQueryParams = URLEncoder.encode(queryParams);
|
encodedPath = path + "?" + queryParams;
|
||||||
encodedPath = path + "?" + encodedQueryParams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(apiRequest.getMethod()), encodedPath, content);
|
HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.valueOf(apiRequest.getMethod()), encodedPath, content);
|
||||||
|
|||||||
Reference in New Issue
Block a user