title: View JSON response/requests while running Intellij
body: <p>I have two services being debugged from two instances of IntelliJ 2017.1.2.  Service A submits a json request to Service B.  Both services are Spring-Boot using REST calls.  </p>
  
  <p>Service A makes a post:</p>
  
  <pre><code>ResponseEntity&lt;InvoiceResponse&gt; response =
                              restTemplate.postForEntity(invoiceUrl, request, InvoiceResponse.class);
  </code></pre>
  
  <p>Service B had an endpoint:</p>
  
  <pre><code> @RequestMapping(value = "/office/{officeId}/invoice", method = RequestMethod.POST)
      @ResponseBody
      public ResponseEntity createInvoice(@RequestBody InvoiceRequest invoiceRequest, @PathVariable("officeId") long officeId) {
  ...}
  </code></pre>
  
  <p>But I get a JWT filter that intercepts the request, and processed it successfully (I have confirmed via breakpoint):</p>
  
  <pre><code>public class JwtAuthenticationTokenFilter extends GenericFilterBean {
  
   @Override
   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
                      ServletException {
       HttpServletRequest httpRequest = (HttpServletRequest) request;
       String authToken = httpRequest.getHeader(this.tokenHeader);
       String username = jwtTokenUtil.getUsernameFromToken(authToken);
       if (username != null &amp;&amp; SecurityContextHolder.getContext().getAuthentication() == null) {
              UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
             if (jwtTokenUtil.validateToken(authToken, userDetails)) {
                  UsernamePasswordAuthenticationToken
                                  authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
                  authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpRequest));
                  SecurityContextHolder.getContext().setAuthentication(authentication);
              }
          }
          chain.doFilter(request, response);
      }
  </code></pre>
  
  <p>This seems to exit normally, as I don't see any errors in the logs.  However, Service A in IntelliJ shows the message: </p>
  
  <blockquote>
    <p>Could not read document: Unrecognized token 'Missing': was expecting
    ('true', 'false' or 'null')  at [Source:
    java.io.PushbackInputStream@7d005eb; line: 1, column: 9]
    com.fasterxml.jackson.core.JsonParseException: Unrecognized token
    'Missing': was expecting ('true', 'false' or 'null')  at [Source:
    java.io.PushbackInputStream@7d005eb; line: 1, column: 9]</p>
  </blockquote>
  
  <p>I don't have any stack traces and stepping thru the code doesn't show me the problem.  I am trying to find a way to examine the JSON coming/leaving Service B so I can see what is being used since that appears to be causing issues with jackson.  Is there anyway to view this in IntelliJ?  If I could get the JSON being sent from Service A, I could recreate the call from Postman, but I can't seem to track the actual json leaving Service A either.</p>
  
  <p>If it matters, I am using Spring-Boot 1.3.5 and Java 8 on OS X</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I added the following to Service A per Patrick Bay suggestions:</p>
  
  <pre><code>@Bean
  public CommonsRequestLoggingFilter requestLoggingFilter() {
      CommonsRequestLoggingFilter loggingFilter = new CommonsRequestLoggingFilter();
      loggingFilter.setIncludeClientInfo(true);
      loggingFilter.setIncludeQueryString(true);
      loggingFilter.setIncludePayload(true);
      return loggingFilter;
  }
  </code></pre>
  
  <p>But I still don't see any json to help me see what is wrong with my request:</p>
  
  <blockquote>
    <p>DEBUG 74188 --- [nio-8081-exec-3] o.s.web.client.RestTemplate<br>
    : Writing [com.common.invoice.InvoiceRequest@44471e8e] as
    "application/json;charset=UTF-8" using
    [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@610fefeb]
    DEBUG 74188 --- [nio-8081-exec-3] o.s.web.client.RestTemplate<br>
    : POST request for "<a href="http://localhost:8998/office/1/invoice" rel="nofollow noreferrer">http://localhost:8998/office/1/invoice</a>" resulted
    in 200 (null) DEBUG 74188 --- [nio-8081-exec-3]
    o.s.web.client.RestTemplate              : Reading [class
    com..common.invoice.InvoiceResponse] as "application/json" using
    [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@610fefeb]
    ERROR 74188 --- [nio-8081-exec-3] c.finance.Connector   : Could not
    read document: Unrecognized token 'Missing': was expecting ('true',
    'false' or 'null')</p>
  </blockquote>
  
  <p>I also tried inspecting the HttpRequest in my Service B JwtAuthenticationTokenFilter. I have tried navigating thru it, but I don't see the actual body that I am sending. I do see the correct url in the request, but once the filter successfull processes it, the actual endpoint ("/office/1/invoice") is never reached because I think Service B blows up</p>