How To Pass/Share JSESSIONID Between Two Web Apps Deployed On A Weblogic Server?
Last updated on APRIL 07, 2017
Applies to:Oracle Coherence - Version 220.127.116.11 and later
Information in this document applies to any platform.
***Checked for relevance on 04-Apr-2017***
How to pass/share the JSESSIONID cookie programmatically between two web apps deployed on same weblogic node?
Two web apps, app1 and app2 deployed on the same weblogic node. Weblogic coherence node is storage enabled. Only 1 member is in the Coherence cluster and that is the weblogic coherence node.
App1 URL: http://localhost:7031/app1/
App2 URL: http://localhost:7031/app2/
Request flow is as follows:
- Browser opens App1 URL
- App1 index.jsp gets/creates the JSESSIONID and calls App2 using HttpURLConnection in the same jsp by passing the JSESSIONID.
- App1 gets response from App2 and sends it to browser
The problem here is with the very first request to App1. App2 is creating a new JSESSIONID even though App1 is sending its JSESSIONID. However, all subsequent requests to App1 from same browser shows that App1 and App2 have same JSESSIONID, which is created in the very first request to App1.
This is the original code in App1's index.jsp passing JSESSIONID to app2
It appears that when the session object is created the very first time, it is not shared between the 2 apps until the Http response is written to the client.
Is there any workaround for such scenario?
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms