go back to the articles list

Is there any static variable type available in server side?

Question:
Is there any static variable type available in server side ? so that I can change that variable globally.

Answer:
Yes. With FMS2 you can actually set variables in the application.xml file. Now if you set these variables in this file and put the application.xml file in the application directory, the variables you set will be available to instances of that application only. Not any others.

If you don't put an application.xml file in the application directory of the application that you are running, then FMS will default to the level higher which would be the conf directory for the virtualhost you are running and look in there. That's where we are going to set our variable.

So, open up the application.xml file in some text editor and jump down to the tag
<code><JSEngine></code>

In there we are going to add a couple of new tags:
<code><ApplicationObject></code>

Inside there:
<code><config></code>

And in there we are going to add a super user tag and put my name in it:
<b>superUser</b>

<i>Graeme Bull</i>

So it looks like this:
<code>
<JSEngine>

     <ApplicationObject>

          <config>

               <superUser>Graeme Bull</superUser>

          </config>

     </ApplicationObject>

</JSEngine>
</code>

Now, save the file, restart the server and make a main.asc file because we are now going to trace this value out:

application.onAppStart = function(){
     trace("The Super User is: " + application.config.superUser);
}

Now when you start up the application you should see the following trace:

<b>The Super User is: Graeme Bull</b>

That's it :)

Posted by: Graeme Bull on Feb 04, 2006

Share This Article

Willow | Wowza Media Server Management made easy

Willow | Wowza Media Server Management made easy

Willow is the answer to any Wowza Media Server developer's or administrator's problem of how to see what your Wowza Media Server is doing at any one time.We created Willow to meet our needs to be able to see what is going with our applications and servers publishing and playing all types of streams and shared objects.

$149 Buy Now