CORS with com.sun.net.httpserver
<p>I am using this code but Chrome will not show me the headers, it seems that there are not added:</p>

<pre><code>Headers headers = httpExchange.getResponseHeaders();
headers.add("Access-Control-Allow-Headers","x-prototype-version,x-requested-with");
headers.add("Access-Control-Allow-Methods","GET,POST");
headers.add("Access-Control-Allow-Origin","*");

httpExchange.sendResponseHeaders(responseCode, responseBody.length());
OutputStream os = httpExchange.getResponseBody();
os.write(responseBody.getBytes());
os.close();
</code></pre>

<p>What am I doing wrong?</p>