当前位置:网站首页>The problem of distinguishing and sharing sessions for multiple applications in tongweb

The problem of distinguishing and sharing sessions for multiple applications in tongweb

2022-06-13 05:42:00 t007321

Application scenarios :

The same TongWeb Several application systems are deployed in the lower part ( Such as : application A And applications B), Multiple application systems need to jump to each other .

Need one : Need to access each other's application context

terms of settlement :

Cross context access , You need to configure parameters in the startup script -Dopenejb.crosscontext=true

amount to tomcat Of <Context path="/A" debug="0" reloadable="true" crossContext="true" />

such B The applied code is available :req.getSession().getServletContext().getContext("/A") obtain A The context of .

Demand two : Multiple applications should be distinguished http The head of the jsessionid, In order to avoid confusion

terms of settlement :

In application web.xml in Custom session cookie Name

<session-config>
     <session-timeout>30</session-timeout>
     <cookie-config>
         <name>MYJSESSIONID</name>   
     </cookie-config>
</session-config>

Demand 3 : Multiple applications need to share one jsessionid, but session The attribute values stored in are different

terms of settlement :
Configure parameters in the startup script :   -DSharedSessionContext=true
This is reuse http Request based on Cookie Incidental jsessionid, No new ID, Applicable to cross application jump and SSO application .ID Although the same , but session The attribute values in are different .

Demand 4 : Multiple applications need to share one jsessionid,session The attribute values stored in the are the same

terms of settlement :

Configure parameters in the startup script :   -DSharedSessionContext=true    -DSharedSessionEnable=true
The two parameters are true, Indicates that multiple applications share session.
原网站

版权声明
本文为[t007321]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202280507591385.html