tags:

views:

74

answers:

2

I've got a Flex application running on a JBoss server, with dev/QA/production environments. The application needs to coordinate with some other services, also with QA/prod instances. Currently I'm sending the current URL in via javascript values, like this:

index.template.html

AC_FL_RunContent(
    "FlashVars", "myhost=" + location.hostname,
    etc

index.mxml:

switch (mx.core.Application.application.parameters.myhost) {
   case "qa.servername.com":
       xmlURL = "http://server.com/qa.xml";
       break;

and so on. I'd rather not do that though; I'd rather edit a .properties file in JBoss to identify a particular machine as QA or Production and access that value via Flex. Any way to do that?

A: 

You could create a small servlet that accesses this properties file and sends the appropriate value to the Flex app.

fvu
A: 

Unless you deploy the properties file with your web app, you won't be able to access them directly in Flex. So you'll need a remote object or a httpservice to retrieve these values.

If you do deploy the properties file with the web app, Spring ActionScript has support for loading properties files: http://www.springactionscript.org/docs/reference/html/container-documentation.html#external_property_files

Christophe Herreman