title: How to send status from servlet to client?
body: <p>My client uploads a file to my web application where the file is processed and the file is returned to the client. My client is written in java and so is server side application using servlets. My problem is when there is some error in processing, how to send the error to the client from the server. So that client do not go for downloading the file, instead just exit by printing the error. I don't know what is the standard way of communication this message with the client.
  What I am doing currently is using <code>response.setHeader</code> : </p>
  
  <pre><code>response.setHeader("codesign-status", "0");
  response.setHeader("codesign-msg", "File available for download ");
  </code></pre>
  
  <p>And I am reading these header on client connection to check for error.
  Is this standard way of communicating messages with client?</p>