Vigay.com27
Jun
Search Vigay.com
 
 

InetSuite URL broadcast mechanism

When an application wishes for a URL to be opened but does not know how to, it should broadcast a WIMP message that has event data in the following form:

union {
char *ptr;
int offset;
} string_value;

struct {
wimp_msghdr hdr;
union {
char url[236];
struct {
int tag;
string_value url;
int flags;
string_value body_file;
string_value target;
string_value body_mimetype;
} indirect;
} data;
} event_data;

If the string representing the URL that needs to be opened is less than 236 bytes long and no body file or window target needs to be specified then it may be sent in the array of bytes event_data.data.url.

Otherwise the indirect form must be used. The tag value event_data.data.indirect.tag should be set to zero. Each of the 'string_value' fields above can then be in one of three catagories:

= 0 field has no value.
< 236 field is a byte offset from the start of the message data area (&event_data.data) to the start of a string in the message body, not neccesarily word-aligned.
>= 0x01800000 field is a pointer to a string in shared memory (RMA or dynamic area).
other values reserved.

The flags word should have bit 0 set to use the body_mimetype field (for specifying a MIME type when sending form data). All other bits are currently all reserved and should be set to zero.

The target is the name of the frame or window in which the URL should be opened. See the Netscape documentation at http://www.netscape.com/assist/net_sites/frames.html for more details on frame names. By default the URL is opened in a new window.

The body_file is the file name of form data to be posted to the given URL (or 0 for no form data). By default, the MIME Content-Type for this form data is application/x-www-form-urlencoded, but can be changed by using the body_mimetype field. The file will be deleted by the message recipient after it has been sent.

The WIMP message wimp_MOPENURL, number 0x4AF80, should be broadcast with the above data, with an event code of wimp_ESENDWANTACK.

When an application receives the about WIMP message it should first determine where the URL is stored by testing the length of the string in event_data.data.url. If this is non-zero it should use the immediate string otherwise it should use the indirected strings. The application should examine the string and determine whether it can service the request. If it can service the request it should acknowledge the WIMP message before it next polls the WIMP manager.
If it can not service the request it should simply ignore the message.

In the indirected case the application should also check the size of the message block to see which fields in the indirect block are valid. Older applications (such as those in the ANT Internet Suite release I) will broadcast the indirect request with only the tag and url fields. In this case the message will be 28 bytes long.

Note that for maximum compatibility with older receiving applications the indirected URL field should always point into the RMA or a dynamic area as otherwise an older application will attempt to interpret the 'offset' form as a direct pointer and read from zero page which may cause a data abort.

New applications should allow for the URL being in offset or direct pointer form however for maximum flexibility.

If the requesting application receives a 'bounced' version of the WIMP message it should try to start an application to open the URL. It does so by issuing a Wimp_StartTask SWI with the command:

URLOpen_<scheme> <URL>

If this raises an error the appliaction should notify the user that the URL could not be followed.

If no 'bounce' is received then the application should assume that the URL has been opened by some other application.

This message may be sent or handled by a number of applications. A WWW browser will send the message when the user tries to follow a link with a method that is not supported internally to the browser. The browser may also respond to the message when the method is 'http', 'https', 'ftp' or 'gopher'.

eg, ANT !Fresco ®. An email or news application should examine URLs and respond to those that have a method of 'mailto', 'news' or 'nntp'. eg, ANT !Marcel ®. This application may also allow the user to menu over the body of a mail or news item, try to pick out a fragment of text below the pointer that looks like a URL, and broadcast a request made from this. An FTP client should detect requests with a method of 'ftp' and service them accordingly. Note that URL methods (or 'schemes') are not case sensitive, and so both 'HTTP://www.ant.co.uk/' and 'http://www.ant.co.uk/' are valid.

Applications should, as well as accepting the WIMP message, provide a startup option that allows a URL to be specified on the command line.

They should then set appropriate aliases to start the application when a URL of a known scheme is found. Thus a WWW browser should have in its !Boot file a line such as:

if "<Alias$URLOpen_HTTP>" = "" then
Set Alias$URLOpen_HTTP Run <Obey$Dir> -URL %%*0

URLs for files on RISCOS filing systems (for example, ADFS, SCSI, NFS, etc), the file:/ scheme should be used. The mapping between RISCOS path names and URLs is very simple:

'/' is swapped with '.'
'#' is swapped with '*'

So for example:

test/html
=> file:/test.html

ADFS::disc.$.test/html
=> file:/ADFS::disc/$/test.html

SparkFS#SCSI##disc.$.!new/arc:$.Welcome/html
=> file:/SparkFS*SCSI**disc/$/!new.arc:$/Welcome.html

To launch a WIMP message like this from a BASIC application:

DIM a% 256
a%!0=256
a%!12=0
a%!16=&4af80 : REM wimp_MOPENURL
$(a%+20)="http://www.ant.co.uk/"+CHR$(0)
SYS "Wimp_SendMessage",18,a%,0,0

Note that this simple example only launches a direct URL of up to 235 characters, and doesn't cope with that message being bounced (and so falling back to the *URLOpen_http command). A complete example URL-launcher program can be found at URL launcher.

Please contact me if you have corrections, or questions relating to this document.

Add a comment to this article

I am sorry to report that no further comments are to be left for articles here. We thank you for past comments. This feature has been disabled.

Email Email this page to a friend

Last edit: 10th Apr 2016 at 1:55pm
(443 days ago)

Bookmark with:What are these?
delicious Deliciousdigg Diggreddit redditfacebook Facebookstumbleupon StumbleUpon

RSS Feed

Viewed 4035 times since 12th May 2006,
~ 0 views per day

^
 
Valid HTML 4.01!
Valid CSS!
Best viewed with a cup of tea Crafted by RISC OS