简体   繁体   English

从HttpRequestExecutingMessageHandler获取请求正文,URL

[英]Getting request body, url from HttpRequestExecutingMessageHandler

在执行请求之前,有什么方法可以从HttpRequestExecutingMessageHandler获取请求正文和url(用于级别信息的日志)?

There is a code like org.springframework.http.client.support.HttpAccessor in the: 在以下位置有一个类似org.springframework.http.client.support.HttpAccessor的代码:

if (logger.isDebugEnabled()) {
    logger.debug("Created " + method.name() + " request for \"" + url + "\"");
}

So, turning on DEBUG for the org.springframework.http.client.support you can see the URL in the logs. 因此,打开org.springframework.http.client.support DEBUG可以在日志中看到URL。

The body you can see via debug message in the org.springframework.web.client.RestTemplate : 您可以通过org.springframework.web.client.RestTemplate调试消息看到的主体:

logger.debug("Writing [" + requestBody + "] using [" + messageConverter + "]");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM