0

Right now I have my URLs hard-coded for HTTPService to work with my local machine's web server so that I don't need to copy files to htdocs after compiling. What's a good technique to easily transition HTTPService URLs from working on my testing setup to working with a normal web server setup?

Anonymous1
  • 3,877
  • 3
  • 28
  • 42

1 Answers1

1

Write a service to get the current environment your application is in, similar to how one tests if you're running in AIR or Flex.

In your HTTPService:

url="EnvironmentService.getURL1();"

In EnvironmentService:

public static function getUrl1():URL
{   
     return (LOCAL_ENVIRONMENT)? LOCAL_URL1 : LIVE_URL1;
}

If this doesn't work for you, post some more code and we'll work on a solution

Ian T
  • 761
  • 4
  • 7
  • How do you set LOCAL_ENVIRONMENT? – Anonymous1 Feb 10 '11 at 15:44
  • That's completely up to you when writing EnvironmentService. You can set it at runtime by doing a quick test or you can hard-code it before compilation. For a test, make a request to the local URL, it if fails, try the live URL, if that works, set LOCAL_ENVIRONMENT to false; – Ian T Feb 10 '11 at 15:49