Environment Hook Up’s

If you would like to dynamically configure the RemoteObject’s endpoint to point to Development server, Production server, Training server or your Local Server, and also if you would like to append a Secure AMF or a non secure AMF messagebroker servlet, please see below

package org.util
import mx.core.FlexGlobals;

public class EnvironmentUtil
public static const DEV_SERVER_URL:String             = 'https://abcd-dev.xyz.ab.org/contextroot/';
public static const LOCAL_SERVER_URL:String           = 'https://localhost:9443/contextroot/';
public static const SYSTEMS_TEST_SERVER_URL:String    = 'https://abcd-sys.xyz.ab.org/contextroot/';
public static const TRAINING_SERVER_URL:String        = 'https://abcd-trn.xyz.ab.org/contextroot/';
public static const TRANSIENT_SERVER_URL:String       = 'https://{server.name}:{server.port}/workerportal/';

public static function get defaultServer():String
   return EnvironmentUtil.DEV_SERVER_URL;

public static function get isNotProduction():Boolean
  return (isDevEnvironment() || isLocalEnvironment());

public static function get remoteEndPoint():String
   var remoteURL:String = EnvironmentUtil.isLocalEnvironment() ? defaultServer : EnvironmentUtil.TRANSIENT_SERVER_URL;
     remoteURL += "messagebroker/amf";
   } else {
      remoteURL += "messagebroker/amfsecure";
  return remoteURL;

public static function isDevEnvironment():Boolean
   return FlexGlobals.topLevelApplication.root.loaderInfo.url.indexOf('213.345.250') != -1;

public static function isLocalEnvironment():Boolean
   return FlexGlobals.topLevelApplication.root.loaderInfo.url.indexOf('file:///') != -1;

public static function isLocalhost():Boolean
     return FlexGlobals.topLevelApplication.root.loaderInfo.url.indexOf('localhost') != -1;
 endpoint="{ EnvironmentUtil.remoteEndPoint }"




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s