Spring has a number of ways of returning an AJAX response to the client. I have found that some ways include cookies in the response header and others ways do NOT include cookies in the response header. Here are two examples.

This is an example where COOKIES ARE INCLUDED. If my controller looks like this. . .

Code:
public String doSomething (Model model, HttpServletRequest request, HttpServletResponse response) {
        lotsOfWork();
        model.addAttribute("key", "value");        
        return "json/options";
}
. . .I get a response from the server with cookies in the header:

Code:
Cache-Control: no-cache, no-store
Content-Language: en-US
Content-Length: 12
Content-Type: text/html;charset=UTF-8
Date: Wed, 06 Jun 2012 14:22:47 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Server: Sun GlassFish Enterprise Server v2.1
Set-Cookie: MY_COOKIE=12345; Path=/myapp
X-Powered-By: Servlet/2.5
This is an example where COOKIES ARE NOT INCLUDED. If my controller looks like this. . .

Code:
public ModelAndView doSomething (HttpServletRequest request, HttpServletResponse response) {
        lotsOfWork();
        ModelAndView model = new ModelAndView("jsonView");
        model.addObject("key", "value");        
        return model;
}
. . .I get a response from the server with NO COOKIES in the header:

Code:
Cache-Control: no-cache, no-store, no-cache, no-store, max-age=0
Content-Language: en-US
Content-Type: application/json;charset=UTF-8
Date: Wed, 06 Jun 2012 14:29:44 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT, Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache, no-cache
Server: Sun GlassFish Enterprise Server v2.1
Transfer-Encoding: chunked
X-Powered-By: Servlet/2.5

So why am I getting cookies in one response but not the other? And, how can I ensure I always have the COOKIES included in the response??