title: How to set content-length in Spring MVC REST for JSON?
body: <p>I have some code:</p>
  
  <pre><code>@RequestMapping(value = "/products/get", method = RequestMethod.GET)
  public @ResponseBody List&lt;Product&gt; getProducts(@RequestParam(required = true, value = "category_id") Long categoryId) {
      // some code here
      return new ArrayList&lt;&gt;();
  }
  </code></pre>
  
  <p>How could I configure Spring MVC (or MappingJackson2HttpMessageConverter.class) to set right header Content-Length by default? Because now my response header <code>content-length</code> equal to -1. </p>