Andreas Raab uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-fbs.86.mcz==================== Summary ====================
Name: Network-fbs.86
Author: fbs
Time: 2 September 2010, 12:59:08.754 pm
UUID: 48ad5323-5811-6144-a0dc-3de4c9c61a17
Ancestors: Network-fbs.85
Configurable scheme->Url class mapping.
"Url registerUrlClass: HttpUrl forScheme: 'http'" lets
'
http://localhost/' asUrl
return an HttpUrl.
If no explicit mapping exists, foo asUrl returns a GenericUrl.
=============== Diff against Network-ar.84 ===============
Item was changed:
----- Method: Url class>>urlClassForScheme: (in category 'parsing') -----
urlClassForScheme: scheme
+ ^ SchemeRegistry at: scheme ifAbsent: [GenericUrl].!
- (scheme isNil or: [scheme = 'http']) ifTrue: [^HttpUrl].
- scheme = 'https' ifTrue: [^HttpUrl].
- scheme = 'ftp' ifTrue: [^FtpUrl].
- scheme = 'file' ifTrue: [^FileUrl].
- scheme = 'mailto' ifTrue: [^MailtoUrl].
- scheme = 'browser' ifTrue: [^BrowserUrl].
- ^GenericUrl!
Item was added:
+ ----- Method: Url class>>registerUrlClass:forScheme: (in category 'class initialization') -----
+ registerUrlClass: aClass forScheme: aString
+ SchemeRegistry at: aString put: aClass.!
Item was changed:
Object subclass: #Url
instanceVariableNames: 'fragment'
+ classVariableNames: 'SchemeRegistry'
- classVariableNames: ''
poolDictionaries: ''
category: 'Network-Url'!
!Url commentStamp: '<historical>' prior: 0!
A Uniform Resource Locator. It specifies the location of a document on the Internet. The base class is abstract; child classes break different types of URLs down in ways appropriate for that type.!
Item was added:
+ ----- Method: Url class>>initialize (in category 'class initialization') -----
+ initialize
+ super initialize.
+ SchemeRegistry := Dictionary new.
+ SchemeRegistry
+ at: 'browser' put: BrowserUrl;
+ at: 'file' put: FileUrl;
+ at: 'ftp' put: FtpUrl;
+ at: 'http' put: HttpUrl;
+ at: 'https' put: HttpUrl;
+ at: 'mailto' put: MailtoUrl.!