permaculture playing cards*
The moose likes JSP and the fly likes Passing session between two web application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing session between two web application" Watch "Passing session between two web application" New topic
Author

Passing session between two web application

Wang Hsin Yoong
Greenhorn

Joined: Oct 08, 2006
Posts: 10
Dear all,

I have this problem.



I want to pass session from E-system JSP page to a Alfresco DMS JSP page.
I have tried many methods but still fail.

Is there any way to do this?
This two application locate in same tomcat server

Thanks you.
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306
Your question of sharing the session is not clear or not complete.
I want to pass session from E-system JSP page to a Alfresco DMS JSP page.
I have tried many methods but still fail.

Is there any way to do this?
This two application locate in same tomcat server


Are these running in two different JVM's? Assuming there can be more than one jvm's running in one application server.

If not what is the operation you are truying to do on the Alresco DMS application. If it is a 'get' or 'post' use HttpClient to access the second's UI layer from first's business layer.
Wang Hsin Yoong
Greenhorn

Joined: Oct 08, 2006
Posts: 10
Thanks for your reply.

I think this two web application is running under a same JVM. I am not very sure abt this because i only install one JDK in my workstation.

The Alfresco DMS do not support the GET method which i read this from their forum.

I am writing a JSP form (called bridge.jsp) to pass the username and password from the E-system to Alfresco DMS through session. The bridge.jsp in locate at the E-Systems application. While I try to retrieve the username and password through the session from Alfresco DMS (using login.jsp), it retrieve NULL value with the same session variable in Alfresco DMS.

When i try to debug this problem, i am using the E-System application to retrieve back the username and password through the session, it works by return the exact username and password. This show that this two application is using two different session space, am i right? how to join this two application session space into one?

Thanks you.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Similar thread found.
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306

When i try to debug this problem, i am using the E-System application to retrieve back the username and password through the session, it works by return the exact username and password. This show that this two application is using two different session space, am i right?

You are right. Both application have two different sessions.




how to join this two
application session space into one?

Each session have it's own session id. You are thinking in a way that both sessions should have same session id. In my opinion this is not the right way to go.

lets rewind a little back. What you listed in this thread is a solution which you think is the best. The issue is not yet clear to me. I feel your issue is only in getting authentication.

What you are trying here is a single client accessing two different applications. But you are trying this at the client end. Probably a server to server communication is your solution.

But you need to have a good understanding about the architecture. Your issue is an architecture issue if the two applications don't share a jvm (today and in future).

At the server side you can take parameters and attributes from session and create a URL connection to other server and pass the parameters and attrributes in url. This way you will be exposing the parameters in URL for the get request.

There is a way you can do a post by not exposing the parameters in URL. That is to open a dummy browser at clients end, submit the form to other server and close the boowser. In this approach your parameters will be hidden fields in the form.
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306

I am writing a JSP form (called bridge.jsp) to pass the username and password from the E-system to Alfresco DMS through session. The bridge.jsp in locate at the E-Systems application. While I try to retrieve the username and password through the session from Alfresco DMS (using login.jsp), it retrieve NULL value with the same session variable in Alfresco DMS.


Make sure you are debugging the following way
1. You generate and display the bridge.jsp from E-Systems.
2. Then you post the form in bridge.jsp to Alfresco.

In step 2 the synchronization between client browser and 1st session may be broken. Because in step 2 a new session is created for Alfresco. But the input fields in the form should be available in the new request.

I understood that you are checking in the session. Did you check in the request with a request.getParameter("userid") before checking in session?

Probably you are aware that unless you explicitly take the parameters from request and put it in session these parameters are not going to be available in session.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing session between two web application