Apollo Alpha 1 Documentation - collected by Jimbob | Back to MY RESOURCES


Other Apollo features

Back to: Apollo Documentation home page

This topic includes information on other features added to the Apollo runtime. These are available from ActionScript and JavaScript in Apollo. Note that these are not available to SWF content running in the browser (in Flash Player).

Contents
  1. The URLRequest class
    1. Using Apollo URL schemes in URLRequest object URLs
  2. The URLStream class
  3. The LocalConnection class
  4. The ByteArray class

The URLRequest class

The URLRequest class lets you define more than simply the URL string. You can define the following properties as well:

NameEffect
contentTypeThe MIME content type of any POST data.
dataAn object containing data to be transmitted with the URL request.
followRedirectsSpecifies whether redirects are to be followed (true) or not (false). This is only supported in the Apollo runtime.
manageCookiesSpecifies whether the HTTP protocol stack should manage cookies for this request. This is only supported in the Apollo runtime.
methodControls whether the HTTP form submission method is a GET or POST operation.
requestHeadersThe array of HTTP request headers to be appended to the HTTP request.
shouldAuthenticateSpecifies whether authentication requests should be handled (true or not (false) for this request. This is only supported in the Apollo runtime.
shouldCacheResponseSpecifies whether successful response data should be cached for this request. This is only supported in the Apollo runtime.
useCacheSpecifies whether the local cache should be consulted before this URLRequest fetches data. This is only supported in the Apollo runtime.
userAgentSpecifies the user-agent string to be used in the HTTP request.

Note that the URLRequest class in Apollo includes support for the following properties, which are not supported in SWF content running in Flash Player:

These properties, which define certain aspects of loading and caching content, are not available to SWF content running in Flash Player, because the browser defines these aspects for SWF content running in the browser. For details of these objects, see the URLRequest class in the Apollo ActionScript 3.0 Language Reference.

Also note that content running in the Apollo application security domain can specify strings other than "GET" or "POST" as the method property.

Using Apollo URL schemes in URLRequest object URLs

You can also use the Apollo URL schemes when defining a URL for a URLRequest object:

You can use the schemes in addition to the schemes that the URLRequest class supports in Flash Player (such as http:</tt>).

You can use a URLRequest object that uses any of these URL schemes to define the URL request for a number of different objects, such as a FileStream or a Sound object. You can also use these schemes in HTML content running in Apollo; for example, you can use them in the src attribute of an img tag.

The URLStream class

The URLStream class provides low-level access to downloading data from URLs. In the Apollo runtime, the URLStream class includes a new event: httpResponseStatus. Unlike the httpStatus event, the httpResponseStatus event is delivered before any response data. The httpResponseStatus event (defined in the HTTPStatusEvent class) includes a responseURL property, which is the URL that the response was returned from, and a responseHeaders property, which is an array of URLRequestHeader objects representing the response headers that the response returned.

The LocalConnection class

The LocalConnection class enables communications between Apollo applications, as well as among Apollo applications and SWF content running in the browser.

The connect() method of the LocalConnection class uses a connectionName parameter to identify applications. In content running in the Apollo application security sandbox (content installed with the Apollo application), Apollo uses the string app# followed by the application ID for the Apollo application (defined in the application descriptor file) in place of the superdomain used by SWF content running in the browser. For example a connectionName for an application with the application ID com.example.apollo.MyApp, the connectionName resolves to "app#com.example.apollo.MyApp:connectionName".

The ByteArray class

The Apollo runtime includes two new methods in the ByteArray class: deflate() and inflate(). You can use these to decompress and compress data the byte array using the DEFLATE and FLATE compression algorithm. For example, you could use these to decompress data in a ZIP file.


Back to: Apollo Documentation home page


collected by Jimbob 2007.05