WMLScript Developer's Guide

[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Chapter 5 - Pragmas
Section 25 out of 57 total sections , Section 3 out of 4 sections in this chapter


Access Control

You can use an access control pragma to protect a file's content. You must call the access control pragma before calling external functions. Using more than one access control pragma in a file generates a compiler error.

Every time your code calls an external function, the compiler performs an access control check to determine if the destination file allows access from the caller. The access control pragma specifies domain and path attributes against which the compiler performs its access control checks. If a file has a domain or path attribute, the referring file's URL must match the values of the attributes. The compiler performs matching as follows:

Domain and path attributes follow URL capitalization rules.

The compiler performs domain suffix matching using the entire element of each sub-domain, and must match each element exactly. For example, www.wapforum.org matches wapforum.org but not forum.org.

The compiler performs path prefix matching using entire path elements and must match each element exactly. For example, /X/Y matches /X, but not /XZ.

The domain attribute defaults to the current file's domain. The path attribute defaults to the value " / ".

To simplify the development of applications that may not know the absolute path to the current file, the path attribute accepts relative URLs. The user agent converts the relative path to an absolute path and then performs prefix matching against the path attribute. For example, if the access-control attributes for a file are

use access domain "wapforum.org" path "/finance";  

the following referring URLs would be allowed to call the external functions specified in this file:

http://wapforum.org/finance/money.cgi  
https://www.wapforum.org/finance/markets.cgi  
http://www.wapforum.org/finance/demos/packages.cgi?x+123&y+456  

However, the following URLs would not be allowed to call the external function:

http://www.test.net/finance  
http://www.wapforum.org/internal/foo.wml  

By default, access control is disabled.


[Cover] [Previous Section] [Next Section] [Index]


Part Number DKDS-41-002, UP.SDK Release 4.1, December 2000

Copyright © 1994-2000 Openwave Systems Inc. All rights reserved.
Please send comments and questions to sdk-doc-comments@openwave.com.