How web application request is handled by multiple servers by maintaing the same user session.?

jakarta-ee, java, payment-gateway

Solution

There is something called session replication. It is used in clusters to have all cluster nodes use the same session information. Read the linked site or other resources on how session replication works, if you're curious.

But the systems don't need to share a whole session object. In your case it looks like you're leaving one server and later come back without any special session treatment. The session was just never closed. As if you'd log in in to your favorite web mail site, then move to a completely different page and go back to your web mail site. The session is still there. You're still logged in.

So probably IRCTC site passes some information to the CITI bank site which is required for CITI to process the request along with a token (just a number in the simplest case). When CITI bank is done it calls a IRCTC server with the result code and the token. Using the token the IRCTC server can associate the result code with your session. Then CITI bank just redirects your browser to a IRCTC page. The server there has a updated session an can present you the next page in your order process.

Problem

Want to know how a request is processed by multiple servers maintaining the same user session. For example: We log-in to IRCTC and try to book a ticket. During payment IRCTC lists out multiple bank options with radio buttons for online transaction. Assuming that I decide to do transaction using CITI bank, when I click on CITI Bank radio button I am redirected to CITI Bank website transaction page i.e you will see URL is switched from IRCTC Website to CITI Bank URL. It means I am completely out of IRCTC and switched to CITI BANK website. Now when my payment transaction is completed, I am switched back to IRCTC website from CITI Bank website WITHOUT ENDING THE USER SESSION i.e when I am switched back from CITI bank URL to IRCTC after completing transaction the user session is maintained in logged-in state. I would like to know how this works. - How a request is sent from IRCTC to CITI Bank website - How CITI Bank server receives details from IRCTC - How the same request comes back from CITI Bank to IRCTC i.e how servers are switched (from CITI bank to IRCTC) - How same user session is maintained between two different servers during communication i.e IRCTC will show user as logged-in user when request comes back from CITI Bank to IRCTC after payment transaction is complete. How does same user session maintained while switching between two servers ? I am using Struts frame work. Kindly help me in this regard and implementing the same with some examples. Assuming IRCTC using struts (Jsp/Servlets), which struts component takes the resposibility to send the details of IRCTC to Citi bank and recieve back detials form CITI bank to IRCTC. Is it possible using Requestdispacter.sendRedirect() OR somthing else ? Thanks, - Anand

Original source