So, I need to dynamically change my url for several of my HttpService
objects at runtime.  I had to do something ugly, perhaps there is a
better way.  This worked, and can perhaps save me about 10 extra
HTTPService objects, if I trade out the entire URL.  

Am I missing something, I'm trying to follow the Cairngorm
ServiceLocator pattern, but I need to change the IP and Port at
runtime AND I have about 12 URL's to talk to.  Thoughts?


My services.xml:

<?xml version="1.0" encoding="utf-8"?>
<cairngorm:ServiceLocator xmlns="*"
xmlns:mx="http://www.adobe.com/2006/mxml";
xmlns:cairngorm="com.adobe.cairngorm.business.*">
        
<mx:Script>
<![CDATA[
                        
                        
        public var agentip:String;
        public var agentport:String;
                        
public function setAgentStatusURL():void {
        AgentStatusService.url =
"http://"+agentip+":"+agentport+"/blah/blah";;
}
                
]]>
</mx:Script>





In my Command.execute()

Application.application.services.agentip =
ModelLocator.getInstance().currentAgent.agentip;
Application.application.services.agentport =
ModelLocator.getInstance().currentAgent.agentport;
                        Application.application.services.setAgentStatusURL();

Reply via email to