Setting cookies using a servlet called from a java client
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.
精彩评论