Das man über ColdFusion auch direkt an JAVA-Funktionen heran kommt ist ja bekannt. Hier mal ein weiteres Beispiel für SystemInformationen um unter anderem den Hardware-Namen der Maschine heraus zu bekommen.
name= "getSystemInfo" access= "public" returntype= "Any" output= "false" hint= "returns the computers systemname and/or IP [:##getSystemInfo(‚?‘)##
]" >
name= "type" required= "false" default= "" hint= "getSystemInfo(‚?‘)" >
var mySystem = createObject ( ‚java‘ , ‚java.net.InetAddress‘ ).getLocalHost() >
var mySystemInfo = "" >
expression= "#lCase(arguments.type)#" >
value= "?" >
variable= "mySystemInfo" >
| getSystemInfo(‚Name‘) | #getSystemInfo(‚Name‘)# | returns the ComputerName of the Maschine |
| getSystemInfo(‚IP‘) | #getSystemInfo(‚IP‘)# | returns the IP-Address from the Server |
| getSystemInfo(‚!‘) | #getSystemInfo(‚!‘)# | cfDump from all Methods |
| getSystemInfo(‚?‘) | this Message |
value= "!" >
variable= "mySystemInfo" > var= "#mySystem#" label= "mySystem" expand= "false" >
value= "name" >
mySystemInfo = listFirst (mySystem.getHostName(), ‚/‘ ) >
value= "ip" >
mySystemInfo = listLast (mySystem.getHostAddress(), ‚/‘ ) >
mySystemInfo = mySystem.getLocalHost() >
mySystemInfo >
#getSystemInfo(‚!‘)# liefert dann zb. eine Liste aller zur Verfügung stehenden Funktionen:
