title: I want from a servlet to add some plain text content and two headers to the HttpServletResponse
body: <p>I want to add some plain text and two headers to the <code>HttpServletResponse</code>, the code is the following:</p>
  
  <p><code>resp.setContentType("text/plain");</code></p>
  
  <p><code>resp.getWriter().write(messages.get(next).getContent());</code></p>
  
  <p><code>resp.addHeader("success", "yes");</code></p>
  
  <p><code>resp.addHeader("hasnext", ((Boolean)hasNext).toString());</code></p>
  
  <p>The problem I encounter is that sending the content prevents the sending of the headers. If I don't write the content the headers are received fine, if I include the text they don't.</p>
  
  <p>What is the problem ? </p>