Can I set Web Container custom properties without using the adminconsole? (V6.1.0.9)
Can I use jython to set the web container custom properties? If so how? I'm very inexperienced with jython scripts.
I as planning on using Struts2 but need to set the com.ibm.ws.webcontainer.invokefilterscompatibility custom property each time I deploy my application. I would love to be able to set this property without having to go in to each web console and set it.
Thanks for any help,
Justin
Re: Can I set Web Container custom properties without using theadmin console? (V6.1.0.9)
Here is the jython script to create web container custom properties for a applicaion server. BTW I ran this on 6.0, but I am sure it will work for 6.1 also. give a try.
Thanks
Anant
Application servers > serverName > Web container > Custom Properties
*******************************************************************************
import sys
def wsadminToList(inStr):
outList=[]
if (len(inStr)>0 and inStr[0]=='[' and inStr[-1]==']'):
tmpList = inStr[1:-1].split(" ")
else:
tmpList = inStr.split("\n") #splits for Windows or Linux
for item in tmpList:
item = item.rstrip(); #removes any Windows "\r"
if (len(item)>0):
outList.append(item)
return outList
#endDef
cell = AdminConfig.list("Cell" )
cellName = AdminConfig.showAttribute(cell, "name" )
serverId = AdminConfig.getid("/Server:serverName/" )
serverWebContainer = AdminConfig.list("WebContainer", serverId )
attrs = [["name", "webContainerPropertyName"], ["value", "webContainerPropertyValue"], ["description", "webContainerPropertyDescription"]]
AdminConfig.create("Property", serverWebContainer, attrs )
AdminConfig.save( )
*******************************************************************************
Re: Can I set Web Container custom properties without using theadmin console? (V6.1.0
Anant -- How about if you want to modify this Custom Properties. For example 'ChannelWriteType'. Modify value from false > true. I researched and it would require some how reading properties xmi.
properties xmi:id="Property_1272469765263" name="ChannelWriteType" value="false" description="testing Jython script" /
Any ideas on how to modify a Custom Properties like this?
Thank you...
-Perry
[QUOTE=unix;640056]Here is the jython script to create web container custom properties for a applicaion server. BTW I ran this on 6.0, but I am sure it will work for 6.1 also. give a try.
Thanks
Anant
Application servers > serverName > Web container > Custom Properties
*******************************************************************************
import sys
def wsadminToList(inStr):
outList=[]
if (len(inStr)>0 and inStr[0]=='[' and inStr[-1]==']'):
tmpList = inStr[1:-1].split(" ")
else:
tmpList = inStr.split("\n") #splits for Windows or Linux
for item in tmpList:
item = item.rstrip(); #removes any Windows "\r"
if (len(item)>0):
outList.append(item)
return outList
#endDef
cell = AdminConfig.list("Cell" )
cellName = AdminConfig.showAttribute(cell, "name" )
serverId = AdminConfig.getid("/Server:serverName/" )
serverWebContainer = AdminConfig.list("WebContainer", serverId )
attrs = [["name", "webContainerPropertyName"], ["value", "webContainerPropertyValue"], ["description", "webContainerPropertyDescription"]]
AdminConfig.create("Property", serverWebContainer, attrs )
AdminConfig.save( )
*******************************************************************************[/QUOTE]