use of core.framework.impl.log.filter.JSONParam in project core-ng-project by neowu.
the class RequestParser method logRequestBody.
private void logRequestBody(RequestImpl request) {
ContentType contentType = request.contentType;
if (contentType == null)
return;
Object bodyParam = null;
if (ContentType.APPLICATION_JSON.mediaType().equals(contentType.mediaType())) {
bodyParam = new JSONParam(request.body, contentType.charset().orElse(Charsets.UTF_8));
} else if (ContentType.TEXT_XML.mediaType().equals(contentType.mediaType())) {
bodyParam = new BytesParam(request.body, contentType.charset().orElse(Charsets.UTF_8));
}
if (bodyParam != null)
logger.debug("[request] body={}", bodyParam);
}
use of core.framework.impl.log.filter.JSONParam in project core-ng-project by neowu.
the class HTTPClientImpl method logRequestBody.
private void logRequestBody(HTTPRequest request, ContentType contentType) {
Object bodyParam;
if (ContentType.APPLICATION_JSON.mediaType().equals(contentType.mediaType())) {
bodyParam = new JSONParam(request.body(), contentType.charset().orElse(Charsets.UTF_8));
} else {
bodyParam = new BytesParam(request.body());
}
logger.debug("[request] contentType={}, body={}", contentType, bodyParam);
}
Aggregations