简体   繁体   中英

how to share sessions in weblogic

I have multiple applications running on weblogic. I need to let users to select language (English, Spanish, French, ...) and when they select, all applications they want to use must be base on the language they selected. When I save the Locale in session everything is ok for that application, but when user clicks on the other application (which is out of application scope) the language will be changed to default. Is there any way to share this value between all applications?

Yes. One option is to save the user locale preference in a shared database. Another is to manually send a browser cookie.

If you deploy your applications on same server try to configure JMS at server level on weblogic. please look at this topic which will help you http://middlewaremagic.com/weblogic/?p=1987

Or

use session sharing state mode https://technology.amis.nl/2012/01/18/sharing-session-state-between-jee-web-application-through-weblogic-session-descriptor-of-sharing-enabled/

You have to share the HTTP sessions between the web applications (.war) in the same enterprise application (.ear). In the .ear's weblogic-application.xml add the following setting:

<session-descriptor>
  <sharing-enabled>true</sharing-enabled>
</session-descriptor>

see: http://xmlns.oracle.com/weblogic/weblogic-application/1.2/weblogic-application.xsd and http://xmlns.oracle.com/weblogic/weblogic-javaee/1.2/weblogic-javaee.xsd

CAUTION: When you mix several .wars be careful about the cookie names. In our case mixing .wars (static resources) with default cookie name JSESSIONID and applications with explicitly defined session cookie names, the "shared" cookie name turned to be JSESSIONID, not the explicitly defined one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM