Suppose I have 2 servers, server1 and server2. How can I take data in a cookie from server1, and send it to server2?

Jorge Jordão

You'll have to create a (new) similar cookie on server 2.

Have a ReadCookieServlet running on server1 that

  • Reads the cookie, using request.getCookies()
  • 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
  • Reads the cookie name, value and expiration date request parameters, using request.getParameter().
  • Creates a similar cookie, using response.addCookie().
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.