So, I have created a piece of JavaScript that works just as expected.
Here is the whole page that I used to test:
<html>
<head>
<script type="text/javascript">
function newPopup() {
parameters = 'user=username&password=password&client=curl';
javascript:var req = new XMLHttpRequest();
req.open('POST', '/app/user/auth_token', false);
//Send the proper header information along with the request
req.setRequestHeader("Content-type", "application/x-www-form-
urlencoded");
req.setRequestHeader("Content-length", parameters.length);
req.send(parameters);
alert(req.responseText);
var headers = req.getAllResponseHeaders().toLowerCase();
alert(headers);
}
</script>
</head>
<body>
<input type="button" onclick="newPopup();" value="Go!" />
</body>
</html>
The response contains what is expected and the header doesn't contain
Set-Cookie. This is because the browser grabbed it, set the cookie,
and returned the rest which is exactly what is desired. If you want to
know more about what I have done to debug view the comments in the
only response here:
http://stackoverflow.com/questions/6351390/gwt-preventing-set-cookie-http-header-from-actually-setting-cookie
I am still looking for an answer and am leaning more and more towards
this being an issue with GWT. I read that GWT will pull off certain
headers in debug mode before they get to the Response object, which is
the only mode I have been able to get working. But my server is my own
and it can't scrape the headers from that response, and Set-Cookie
should be handled by the browser before GWT gets its hands on the
response.