I have a java application that connects to a servlet. Once the connection is made, I want to pass the same session to a browser (opened through Runtime.exec). Is this possible? If not, what are the alternatives.
You are trying to maintain the SAME session across the server and the client? You can pass a serialized COPY of the session object to the client, but it is a different object. The server session lives in a different JVM than the browser uses. Are you just trying to make sure that you close the server session when the client closes, or what?
"JavaRanch, where the deer and the Certified play" - David O'Meara
This sounds like one server and two clients, both using the same session. I just have to ask why? I'm not trying to give you a hard time. It's just that this seems to be outside of the normal sessions paradigm, so it makes me ask, what are you trying to accomplish with this scheme? It may be that there is a better way to do it that doesn't involve session sharing and the accompanying potential for concurrency issues. If I had to guess, it sounds like you want to establish the session with the java client, and then pass the session to a web browser. If this is the case, then you have to keep in mind that the notion of a session lives entirely on the server. While it may be possible to fool the server into thinking that there is only the one client, it may be difficult. The active session ID would have to be encoded into the browser's first request. Or, you would somehow have to construct a valid session cookie in the browser. Either way, I don't know if it would work. I think I would need a little better idea of what you want to do before I give "my final answer." [ May 14, 2003: Message edited by: Philip Shanks ]
Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
Thank you for the response. The scenario is, my Oracle forms application executes the java application through the OS class by passing in the username and password. Philip, you are right. Its this java application that connects to the servlet, establishes a session and has to then open a browser and pass the same session to it. And the issue is to pass the same session to the browser. Looking forward to your help.
Destroy anything that stands in your way. Except this tiny ad:
a bit of art, as a gift, the permaculture playing cards