How to write ResponseEntity to HttpServletResponse? : <p>How to write ResponseEntity to HttpServletResponse (as it makes @ResponseBody)?</p>

<p>For example I have authentication success handler:</p>

<pre><code>@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
    Map responseMap = new HashMap();
    responseMap.put("user", "my_user_name");
    ResponseEntity responseEntity = new ResponseEntity(response, HttpStatus.OK);
}
</code></pre>

<p>If use MappingJackson2HttpMessageConverter I have error: "Could not write content: not in non blocking mode."</p>

<p>Code:</p>

<pre><code>HttpOutputMessage outputMessage = new ServletServerHttpResponse(response);
messageConverter.write(responseEntity, null, outputMessage);
</code></pre>

<p>What are the best practices of implementation handlers with HttpServletResponse?</p>
