• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Jacl script to rename the default cookie name (JSESSIONID)

 
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
 
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
 
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()
 
Sheriff
Posts: 3752
62
Netbeans IDE Oracle Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, and thanks for sharing a solution!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!