简体   繁体   English

Spring Webflux Reactor Netty:HTTP请求/响应十六进制转储?

[英]Spring Webflux Reactor Netty: HTTP Request/Response Hex Dump?

What log level we have to set in application.properties in order to see the full HTTP request and response with headers and body as a hex dump in the console from reactor-netty? 我们必须在application.properties中设置什么日志级别,以查看完整的HTTP请求和带有标头和正文的响应,作为控制台中来自Reactor-Netty的十六进制转储

logging.level.reactor.netty=trace

Only shows response http headers. 仅显示响应http标头。

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 248
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1 ; mode=block
Referrer-Policy: no-referrer

Keep the logging level as DEBUG or TRACE and follow the instructions below: 保持日志记录级别为DEBUG或TRACE,并按照以下说明进行操作:

  1. If you want to see the hex dump for the server then you can customise it like this: 如果要查看服务器的hex dump ,则可以像这样自定义它:
@Component
public class MyNettyWebServerCustomizer
        implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> {
    @Override
    public void customize(NettyReactiveWebServerFactory factory) {
        factory.addServerCustomizers(httpServer -> httpServer.wiretap(true));
    }
}
  1. If you want to see the hex dump for the client then you can customise it like this: 如果要查看客户端的hex dump ,则可以像这样自定义它:
WebClient.builder()
        .clientConnector(new ReactorClientHttpConnector(HttpClient.create().wiretap(true)))
        .build();

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

相关问题 如何处理 reactor-netty 在 spring-webflux 中终止请求? - How to handle reactor-netty terminating a request in spring-webflux? Spring Webflux 应用程序,无法获取 reactor.netty.http.client* 指标和 reactor.netty.connection.provider* 指标 - Spring Webflux application, unable to get reactor.netty.http.client* metrics and reactor.netty.connection.provider* metrics 为spring-webflux WebClient配置具有reactor netty的HostnameVerifier - Configure HostnameVerifier with reactor netty for spring-webflux WebClient 将 spring-webflux 微服务切换到 http/2 (netty) - Switch spring-webflux microservice to http/2 (netty) Spring Webflux Reactor上下文 - Spring Webflux Reactor context Spring WebFlux / Reactor核心 - Spring WebFlux/ Reactor core 使用 spring HATEOAS 和 spring webflux 功能 Web 框架 (reactor.netty) - Using spring HATEOAS with spring webflux Functional Web Framework (reactor-netty) 在 Spring Boot &amp; Spring WebFlux (Netty) 中指定服务器请求超时 - Specify server request timeout in Spring Boot & Spring WebFlux (Netty) 人们如何在生产中的 Reactor Netty 上使用 WebFlux 托管 Spring Boot 应用程序? - How do people host Spring Boot apps with WebFlux on Reactor Netty in production? 如何在 Spring Webflux / Reactor Netty Web 应用程序中执行阻塞调用 - How to execute blocking calls within a Spring Webflux / Reactor Netty web application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM