On my development machine using Flex Builder, I use a test server to 
serve up simple xml files that I pull in with the HttpService in my flex 
app.  So a url might look like:

http://test-machine/xml/my_data

However, when we go to deploy, all of the needed servlets are accessed 
using relative paths so the url for the same servlet would simply be:

/xml/my_data

For a while, I was hardcoding the test-machine url (using a shared host 
variable) and then commenting it out before checking my code in. Not a 
very good solution. I stumbled upon the context-root property, and that 
seems to have done the trick:

<mx:HTTPService
        id="MyData"
        url="@ContextRoot()/xml/my_data"
...

This seems to solve my problem nicely. On my dev machine I use the 
compilation switch:

-context-root http://test-machine

So when running my app from flex builder I get my test-machine as a 
target, whereas on the production build nothing is specified so 
@ContextRoot() simply comes back with "".

My only concern is that it looks like context-root is meant for 
something else. Is there some reason why I should not use context-root 
in this way?



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to