I have a REST web service which sends a cookie in the response. REST URL looks like http://localhost:8080/myfoo/service/v1/acc/login
In my java code I have set cookie like below
Response.ok(entity).cookie(new NewCookie("JSESSIONID", "12344", "/", "localhost", null, -1, false));
When I see the response header of the web service, cookie header looks like below
"JSESSIONID=12344;Domain=localhost;Path="/";Version=1"
But, when I make request to another path of same domain like below
http://localhost:8080/mybar/service/v1/acc/profile
cookies are not sent in the request.
So, when I viewed cookies in browser store (using content settings) I saw below entry for the cookie.
Name: JSESSIONID
Content: 12344
Domain: localhost
Path: /myfoo/service/v1/acc/login
Send for: Any kind of connection
Accessible to script: Yes
Created: Wednesday, July 13, 2016 at 5:04:40 PM
Expires: When the browsing session ends
So, if you notice, path attribute of cookie in browser store is different than what REST service had responded with. Any ideas whats going wrong here?