The Inbox: Network-fbs.85.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Network-fbs.85.mcz

commits-2
A new version of Network was added to project The Inbox:
http://source.squeak.org/inbox/Network-fbs.85.mcz

==================== Summary ====================

Name: Network-fbs.85
Author: fbs
Time: 2 September 2010, 11:04:22.63 am
UUID: c0254710-c450-e04a-b5c1-8190fe463e62
Ancestors: Network-ar.84

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: ''
  poolDictionaries: ''
  category: 'Network-Url'!
+ Url class
+ instanceVariableNames: 'schemeRegistry'!
 
  !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.!
+ Url class
+ instanceVariableNames: 'schemeRegistry'!

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.!