Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jacl script to rename the default cookie name (JSESSIONID)

 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, and thanks for sharing a solution!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic