title: Spring-webflux filter to fetch the request body
body: <p>I need to fetch the entire request body in filter and convert it into String. Below is my code but nothing is getting printed on console.</p>
  
  <pre><code>@Component
  public class WebFilter01 implements WebFilter {
  
      @Override
      public Mono&lt;Void&gt; filter(ServerWebExchange serverWebExchange, 
        WebFilterChain webFilterChain) {    
  
          Flux&lt;DataBuffer&gt; requestBody = serverWebExchange.getRequest().getBody();        
  
          Flux&lt;String&gt; decodedRequest = requestBody.map(databuffer -&gt; {
              return decodeDataBuffer(databuffer);
          });     
          decodedRequest.doOnNext(s -&gt; System.out.print(s));
          return webFilterChain.filter(serverWebExchange);
      }
  
  
      protected String decodeDataBuffer(DataBuffer dataBuffer) {
          Charset charset = StandardCharsets.UTF_8;       
          CharBuffer charBuffer = charset.decode(dataBuffer.asByteBuffer());      
          DataBufferUtils.release(dataBuffer);        
          String value = charBuffer.toString();
          return value;
      }
  }
  </code></pre>