Suppose I have 2 servers, server1 and server2. How can I take data in a cookie from server1, and send it to server2?
You’ll have to create a (new) similar cookie on server 2. Have a ReadCookieServlet running on server1 that a) Reads the cookie, using request.getCookies() b) Redirects to WriteCookieServlet running on server2, passing the cookie name, value and expiration date as request parameters, using response.sendRedirect(). Have a WriteCookieServlet running on server2 that c) Reads the cookie name, value and expiration date request parameters, using request.getParameter(). d) Creates a similar cookie, using response.addCookie().