Search in sources :

Example 1 with LogBodyMessage

use of com.dtflys.forest.logging.LogBodyMessage in project forest by dromara.

the class AbstractHttpclientRequestSender method setLogBody.

protected <T extends HttpRequestBase> void setLogBody(RequestLogMessage logMessage, T httpReq) {
    HttpEntityEnclosingRequestBase entityEnclosingRequest = (HttpEntityEnclosingRequestBase) httpReq;
    HttpEntity entity = entityEnclosingRequest.getEntity();
    if (entity == null) {
        return;
    }
    LogBodyMessage logBodyMessage = new HttpclientLogBodyMessage(entity);
    logMessage.setBody(logBodyMessage);
}
Also used : HttpclientLogBodyMessage(com.dtflys.forest.backend.httpclient.logging.HttpclientLogBodyMessage) HttpEntityEnclosingRequestBase(org.apache.http.client.methods.HttpEntityEnclosingRequestBase) HttpEntity(org.apache.http.HttpEntity) LogBodyMessage(com.dtflys.forest.logging.LogBodyMessage) HttpclientLogBodyMessage(com.dtflys.forest.backend.httpclient.logging.HttpclientLogBodyMessage)

Example 2 with LogBodyMessage

use of com.dtflys.forest.logging.LogBodyMessage in project forest by dromara.

the class OkHttp3Executor method setLogBody.

protected void setLogBody(RequestLogMessage message, Request okRequest) {
    RequestBody requestBody = okRequest.body();
    LogBodyMessage logBodyMessage = new OkHttp3LogBodyMessage(requestBody);
    message.setBody(logBodyMessage);
}
Also used : OkHttp3LogBodyMessage(com.dtflys.forest.backend.okhttp3.logging.OkHttp3LogBodyMessage) OkHttp3LogBodyMessage(com.dtflys.forest.backend.okhttp3.logging.OkHttp3LogBodyMessage) LogBodyMessage(com.dtflys.forest.logging.LogBodyMessage) RequestBody(okhttp3.RequestBody)

Aggregations

LogBodyMessage (com.dtflys.forest.logging.LogBodyMessage)2 HttpclientLogBodyMessage (com.dtflys.forest.backend.httpclient.logging.HttpclientLogBodyMessage)1 OkHttp3LogBodyMessage (com.dtflys.forest.backend.okhttp3.logging.OkHttp3LogBodyMessage)1 RequestBody (okhttp3.RequestBody)1 HttpEntity (org.apache.http.HttpEntity)1 HttpEntityEnclosingRequestBase (org.apache.http.client.methods.HttpEntityEnclosingRequestBase)1