I am trying to set a cookie in java code as follows,
Cookie cookie = new Cookie("JSESSIONID=","xxxxxx");
where JSESSIONID= is returned from third party after sso with it.
This code is deployed as a jar file in CS/web-inf/lib. But cookie is not showing in browser. Am i missing anything. ungert help required..
It is generally not recommended to use response object in Sites-managed JSPs. You can use the satellite:cookie JSP tag to set a cookie, see the JSP tag reference at
If your code has been called from within a Sites-managed JSP then you can run the tag using ics.RunTag() method, see the javadoc at
I don't think its because of any cross site scripting problem.
Actually, Webcenter creates two cookies namely JSESSIONID, one of CAS and other for CS and I need to create one more cookie with same name i.e. JSESSIONID that I need to pass to a diff application that is running on a diff server whose IP address is 10.180.59.149.
You can't set cookies for another server's domain. That's against browser security policies. If you could do that you could build a site to hijack other people's sessions on any site you want: they visit your site; you set their session cookie for (for example) facebook.com to some fixed value; you now have access to their facebook session.