This section describes how to make changes to your application server settings.
The context root maps requests to the Flex application. In practice, the context root defines the URL prefix that clients use to request files in your application.
For example, the context root in the following URL is /flex:
http://localhost:8101/flex/myApp.mxml
The value is equivalent to a call to the request.getContextPath() method (Java) or the HttpRequest.ApplicationPath property (.Net).
If you are running Flex on the JRun application server, the context root for Flex is set in the jrun_root/server_name/WEB-INF/jrun-web.xml file. To change the context root, edit the <context-root> tag. The following example changes the context root to /:
<context-root>/</context-root>
The default context root is /flex. You can refer to the context root in the Flex configuration files using the {context.root} token. The value of {context.root} includes the prefix "/". As a result, you are not required to add a forward slash before the {context.root} token.
If {context.root} is used in a nonrelative path, it must not have a leading "/" in front of it. For example, instead of this:
http://localhost/{context.root}
Do this:
http://localhost{context.root}
Nonrelative URLs are often used for the <url> and <https-url> elements in the data service sections of the flex-config.xml file.
To change the context root for non-JRun web application servers, consult your application server documentation.
In MXML tags, you can use @ContextRoot() to specify the context root in a URL, as the following example shows:
<mx:HTTPService url="@ContextRoot()/directory/myfile.xml"/>
Version 1.5
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000875.htm