Example: Configuring applications for session management in Web modules using the wsadmin tool
Use the AdminApp object to set configurations in an application. Some configuration settings are not available through the AdminApp object. This example uses the AdminConfig object to configure session manager for Web module in the application.
- Identify the deployment configuration object for the application and assign it to the deployment variable:
set deployment [$AdminConfig getid /Deployment:myApp/]Example output:
myApp(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#Deployment_1)- Get all the modules in the application and assign it to the modules variable:
set appDeploy [$AdminConfig showAttribute $deployments deployedObject] set modules [lindex [$AdminConfig showAttribute $appDeploy modules] 0]Example output:
(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#WebModuleDeployment_1) (cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#EJBModuleDeployment_1) (cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#WebModuleDeployment_2)- To obtain a list of attributes you can set for session manager, use the attributes command.:
$AdminConfig attributes SessionManagerExample output:
"accessSessionOnTimeout Boolean" "allowSerializedSessionAccess Boolean" "context ServiceContext@" "defaultCookieSettings Cookie" "enable Boolean" "enableCookies Boolean" "enableProtocolSwitchRewriting Boolean" "enableSSLTracking Boolean" "enableSecurityIntegration Boolean" "enableUrlRewriting Boolean" "maxWaitTime Integer" "properties Property(TypedProperty)*" "sessionDRSPersistence DRSSettings" "sessionDatabasePersistence SessionDatabasePersistence" "sessionPersistenceMode ENUM(DATABASE, DATA_REPLICATION, NONE)" "tuningParams TuningParams"- Set up the attributes for session manager:
set attr1 [list enableSecurityIntegration true] set attr2 [list maxWaitTime 30] set attr3 [list sessionPersistenceMode NONE] set attr4 [list enabled true] set attrs [list $attr1 $attr2 $attr3 $attr4] set sessionMgr [list sessionManagement $attrs]This example sets four top level attributes in the session manager. You can modify the example to set other attributes in the seesion manager including the nested attributes in Cookie, DRSSettings, SessionDataPersistence, and TuningParms object types. To list the attributes for those object types, use the attribute command in AdminConfig object.Example output:
sessionManagement {{enableSecurityIntegration true} {maxWaitTime 30} {sessionPersistenceMode NONE} {enabled true}}- Set up the attributes for Web module:
set nameAttr [list name myWebModuleConfig] set descAttr [list description "Web Module config post create"] set webAttrs [list $nameAttr $descAttr $sessionMgr]Example output:
{name myWebModuleConfig} {description {Web Module config post create}} {sessionManagement {{enableSecurityIntegration true} {maxWaitTime 30} {sessionPersistenceMode NONE} {enabled true}}}- Create the session manager for each Web module in the application:
foreach module $modules { if ([regexp WebModuleDeployment $module] == 1} { $AdminConfig create WebModuleConfig $module $webAttrs } }You can modify this example to set other attributes of session manager in Web module configuration.Example output:
myWebModuleConfig(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#WebModuleConfiguration_1)- Save the changes with the following command:
$AdminConfig save