开发者

Setting cookies using a servlet called from a java client

开发者 https://www.devze.com 2023-04-03 03:33 出处:网络
My objective is to set a cookie from within a servlet called from a java client, and get the cookie when a different servlet is called from the browser.

My objective is to set a cookie from within a servlet called from a java client, and get the cookie when a different servlet is called from the browser.

The java client has an authenticated session with the server.

The server runs locally.

I tried suggestions from a different question and rename put an alias domain name in my hosts file.

I manually set the domain of the cookie to the alias domain, but it still 开发者_开发技巧won't return on the server.

request.getRemoteHost() returns 127.0.0.1 in both servlets.

Any help would be appreciated.


A cookie is held in memory (or on disk, but at a specific place) by each client. A Java client and a browser don't share cookies. Two different browsers (IE and Firefox, for example) don't share cookies either. There is no way to do what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消