【问题标题】:jython: port definitionjython:端口定义
【发布时间】:2011-01-05 04:07:48
【问题描述】:

我正在寻找执行以下操作的 jython 脚本:

  1. 服务器 > 应用程序服务器 > server1 > 端口 > WC_default >(设置)端口=8080。

  2. enviornment > virtaul hosts > deault_host > 主机别名 > [如果有主机名==*的条目,则端口= 8080]

非常感谢。

【问题讨论】:

    标签: websphere jython


    【解决方案1】:

    使用以下代码作为起点:

    serverEntries = AdminConfig.list('ServerEntry', AdminConfig.getid('/Node:' + nodeName + '/')).split(java.lang.System.getProperty('line.separator'))
    for serverEntry in serverEntries:
        if AdminConfig.showAttribute(serverEntry, "serverName") == 'server1':
            sepString = AdminConfig.showAttribute(serverEntry, "specialEndpoints")
            sepList = sepString[1:len(sepString)-1].split(" ")
            for specialEndPoint in sepList:
                endPointNm = AdminConfig.showAttribute(specialEndPoint, "endPointName")
                if endPointNm == "WC_defaulthost":
                    ePoint = AdminConfig.showAttribute(specialEndPoint, "endPoint")
                    # at this point you probably want to do a resetAttribute instead of showAttribute
                    defaultHostPort = AdminConfig.showAttribute(ePoint, "port")
                    break
    
    for hostAlias in AdminConfig.getid('/Cell:' + cellName + '/VirtualHost:default_host/HostAlias:/').split(java.lang.System.getProperty('line.separator')):
        if AdminConfig.showAttribute(hostAlias, 'port') == defaultHostPort:
            print "Deleting host alias for port " + defaultHostPort
            AdminConfig.remove(hostAlias)
    AdminConfig.create('HostAlias', AdminConfig.getid('/Cell:' + cellName + '/VirtualHost:default_host/'), [['hostname', '*'],['port', defaultHostPort]])
    

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 2021-07-31
      • 2017-10-11
      • 1970-01-01
      • 2020-05-17
      • 2015-07-13
      • 2013-03-29
      • 2020-11-27
      • 2018-04-08
      相关资源
      最近更新 更多