my dog learned polymorphism*
The moose likes Websphere and the fly likes Jacl script to rename the default cookie name (JSESSIONID) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Jacl script to rename the default cookie name (JSESSIONID)" Watch "Jacl script to rename the default cookie name (JSESSIONID)" New topic
Author

Jacl script to rename the default cookie name (JSESSIONID)

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
Guys,

Application Servers > server1 > Session management > Cookies

Cookie name: JSESSIONID

I want to change this name (JSESSIONID) to somethig else. I want to do this through jacl script.

Can I get any help on this? BTW, I was tryin' this script, but not working.
--------------------------------------------------------------------------
set deployments [$AdminConfig getid /Deployment:GURU/]
set appDeploy [$AdminConfig showAttribute $deployments deployedObject]
$AdminConfig attributes SessionManager
set kuki [list cookieName "guru"]
set cookie [list $kuki]
Set cookieSettings [list defaultCookieSettings $cookie]
set attrs [list $cookieSettings]
set sessionMgr [list sessionManagement $attrs]
$AdminConfig create ApplicationConfig $appDeploy [list $sessionMgr]
$AdminConfig save

Thanks,
Guru
Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 272
I have found out how to give.

set server [$AdminConfig getid /Cell:cellName/Node:nodeName/Server:server1]
[$AdminConfig getid /Cell:CellName/Node:NodeName/Server:server1]
set webContainer [$AdminConfig list WebContainer $server]
set sessionManager [$AdminConfig list SessionManager $webContainer]
set cookies [$AdminConfig showAttribute $sessionManager defaultCookieSettings]
$AdminConfig modify $cookies {{name MyNewName}}
$AdminConfig save

This is working absolutely fine.

Now, my next question is how to replace this literal name with a variable name?

Ex.

wsadmin> set machine_name myMachine
wsadmin> $AdminConfig modify $cookies {{name $machine_name}}

If I give this, I am getting the following exception:
WASX7015E: Exception running command: "$AdminConfig modify $cookies
{{name $mach
ine_name}}"; exception information:
com.ibm.websphere.management.exception.InvalidAttributeValException:
ADMG0012E
The attribute value for attribute name is not valid.

Can I know how to give the variable to the name attribute (instead of
direct literal name)?

Thanks,
Guru
naresh kumar mallala
Greenhorn

Joined: Jun 13, 2011
Posts: 21
actually that script is working in version 7.0,but can any one give the script for same in v6.1

thank you
fespir websphere
Greenhorn

Joined: Dec 10, 2012
Posts: 1
Hey, JACL script was pretty helpful, I customized it into a Jython script.
I am posting it here because someone else might find it useful.

server=AdminConfig.getid("/Cell:<CellName>/Node:<NodeName>/Server:<ServerName>")
webcont=AdminConfig.list('WebContainer',server)
sessman=AdminConfig.list('SessionManager',webcont)
cookies=AdminConfig.showAttribute(sessman,'defaultCookieSettings')
AdminConfig.showall(cookies)
attrs=['name', 'CookieName']
AdminConfig.modify(cookies,[attrs])
AdminConfig.showall(cookies)
AdminConfig.save()
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Welcome to the Ranch, and thanks for sharing a solution!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jacl script to rename the default cookie name (JSESSIONID)