I'm developping a REST Api which needs to be statefull (no workaround for that, i'm using a native lib with no serializable objects etc.)
This Rest API is exposed on a web server on a domain domainA. Response contains a Access-Control-Allow-Origin header set to *, so I needn't JSON-P. (I don't know if this detail cares).
I did a GWT use sample of this API on a domainB requesting DomainA. Browsers do not add the cookie previously set. It's works 'statelessly'.
Must the sample be on DomainA too? Is there a workaroud or an specific header to set?
Edit: I set a main domain in the Cookie. And it doesn't work. The browser still doesn't set the cookie session in the next request header.
Request:
HeadersPreviewResponseCookiesTiming
Request URL:http://subdomainB.mydomain.com/request
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Length:1185
Content-type:application/x-www-form-urlencoded
Host:subdomainB.mydomain.com
Origin:http://subdomainA.mydomain.com
Referer:http://subdomainA.mydomain.com/BLABLABLA
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.8 (KHTML, like Gecko) Chrome/20.0.1105.0 Safari/536.8
Response:
Response Headersview source
Access-Control-Allow-Origin:*
Cache-Control:no-cache, no-store, max-age=0
Connection:Keep-Alive
Content-Language:fr-FR
Content-Type:application/json;charset=UTF-8
Date:Wed, 25 Apr 2012 07:59:03 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT, Thu, 01 Jan 1970 00:00:00 GMT
Keep-Alive:timeout=15, max=100
Pragma:no-cache
Server:Jetty(7.5.4.v20111024)
Set-Cookie:JSESSIONID=cookieValue;Path=/;Domain=.mydomain.com
Transfer-Encoding:chunked