File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Jacl script to rename the default cookie name (JSESSIONID)

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 273

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

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 273
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?


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:
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)?

naresh kumar mallala

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

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.

attrs=['name', 'CookieName']
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3733

Welcome to the Ranch, and thanks for sharing a solution!
I agree. Here's the link:
subject: Jacl script to rename the default cookie name (JSESSIONID)
It's not a secret anymore!