Example: Configuring for session tracking using wsadmin
The following example configures the session management of a Web container for session tracking:
- Identify the appserver and assign it to the server variable:
Using Jacl:
set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
Using Jython:
server = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/') print server
Example output:
server1(cells/mycell/nodes/mynode/servers/server1:server.xml#Server_1)
- Identify the session management belonging to the server and assign it to the smgr variable:
Using Jacl:
set smgr [$AdminConfig list SessionManager $server]
Using Jython:
smgr = AdminConfig.list('SessionManager', server) print smgr
Example output:
(cells/mycell/nodes/mynode/servers/server1:server.xml#SessionManager_1)
- Modify attributes related to session tracking:
- This example command enables cookies and modifies cookie setting:
Using Jacl:
$AdminConfig modify $smgr {{enableCookies true} {defaultCookieSettings {{maximumAge 10}}}}
Using Jython:
AdminConfig.modify(smgr, [['enableCookies', 'true'], ['defaultCookieSettings', [['maximumAge', 10]]]])
- This example command enables protocol switch rewriting:
Using Jacl:
$AdminConfig modify $smgr {{enableProtocolSwitchRewriting true} {enableUrlRewriting false} {enableSSLTracking false}}
Using Jython:
AdminConfig.modify(smgr, [['enableProtocolSwitchRewriting', 'true'], ['enableUrlRewriting', 'false'], ['enableSSLTracking', 'false']])
- This example command enables URL rewriting:
Using Jacl:
$AdminConfig modify $smgr {{enableUrlRewriting true} {enableProtocolSwitchRewriting false} {enableSSLTracking false}}
Using Jython:
AdminConfig.modify(smgr, [['enableUrlRewriting', 'true'], ['enableProtocolSwitchRewriting', 'false'], ['enableSSLTracking', 'false']])
- This example command enables SSL tracking:
Using Jacl:
$AdminConfig modify $smgr {{enableSSLTracking true} {enableProtocolSwitchRewriting false} {enableUrlRewriting false}}
Using Jython:
AdminConfig.modify(smgr, [['enableSSLTracking', 'true'], ['enableProtocolSwitchRewriting', 'false'], ['enableUrlRewriting', 'false']])
- Save the changes with the following command:
Using Jacl:
$AdminConfig save
Using Jython:
AdminConfig.save()