Search in sources :

Example 1 with JSONParam

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);
}
Also used : JSONParam(core.framework.impl.log.filter.JSONParam) ContentType(core.framework.http.ContentType) BytesParam(core.framework.impl.log.filter.BytesParam)

Example 2 with JSONParam

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);
}
Also used : JSONParam(core.framework.impl.log.filter.JSONParam) BytesParam(core.framework.impl.log.filter.BytesParam)

Aggregations

BytesParam (core.framework.impl.log.filter.BytesParam)2 JSONParam (core.framework.impl.log.filter.JSONParam)2 ContentType (core.framework.http.ContentType)1