URLs
Tip icon
To better understand this section, examine the sample SstHttpUrl.
URLs are used to specify and build endpoints. While endpoints can be built programmatically, URLs are a convenient and familiar way of exposing addressing. The SST URL structure is similar to that found in HTTP applications. That is, scheme:/transport/address where the fields have the following meanings:
scheme
The policy or protocol of the data communicated through the endpoint corresponding to the URL. See Method invocation for examples.
transport
The underlying transport to use. The value of this field is used to look up transport classes in a transport table managed by SstTransport class (see Transport configurations). Example transport field values are tcp or cpic. By convention, transports prefixed with a c have client behavior in that they do not accept incoming connections. Client transport examples include ctcp and chttp.
address
The address of the endpoint. The format of this field is transport-dependent. For example, if the transport were TCP, the address field would contain the IP address (name or number) and optional port separated by a colon (for example, foo.bar.com:80).
The following are some example URLs. Refer to the relevant transport sections for more exact semantics on how the address fields are interpreted. See Method invocation for explanations of the schemes used.
fooScheme:/tcp/foo.bar.com:80
Indicates TCP communications with server behavior to a machine called foo.bar.com. Connections to that endpoint can be made by connecting to port 80. The invocation configuration scheme is known as fooScheme.
barScheme:/tcpl
Indicates a client TCP endpoint. This endpoint can only be used to create new TCP connections. Such connections can be used for both send and receive. One client endpoint can be used to connect to many remote server endpoints. Since no address is given, the IP address will be INADDRANY, and a the port will be that specified as the transport configuration's defaultPort. The invocation configuration scheme being used is known as barScheme.
fooScheme/imap4/bob:secret@host:port
Indicates an IMAP endpoint which manipulates mail for user bob with password secret on the server at the TCP address host:port.
iiop://host:port
Has an implicit transport of iiop.
URLs are represented in Smalltalk by the class SstUrl and its subclasses. In addition to the typical accessor methods, SST provides the following API in support of URLs:
fromString: urlString (SstUrl class)
Answers a new instance of the receiver derived from @urlString parsed as a URL of the form scheme:.
asUrl (String class)
Answers the receiver parsed as a URL. The receiver should be of the form scheme:/transport/address where the address field is optional and in a transport-specific format.
Since the format of a URL is scheme-specific, SST manages a table of URL parsers indexed by scheme. This object must understand the message buildUrlFromString:scheme:transport: and return a valid URL or nil. Note that address parsing is typically handled by the transport's address class through the sstGenerateAddress:configuration: protocol. Parsers are (un)registered using the following protocol on SstUrl.
register: urlScheme as: urlParser
Registers @urlParser as the parser to use to interpret URL strings starting with @urlScheme.
unregister: urlScheme
Unregisters the parser for URL strings starting with @urlScheme.
Last modified date: 04/20/2020