Cool!!
Here's a change to hook your code in for file: and ftp: accesses.
Lex
'From Squeak 2.3 of January 14, 1999 on 1 February 1999 at 8:57:33 am'!
!MIMEDocument class methodsFor: 'content-types' stamp: 'ls 2/1/1999 08:55'! guessTypeFromName: url "guesses a content type from the url" | extension | extension _ url asString. (extension includes: $.) ifFalse: [ ^self defaultContentType].
extension _ (extension findTokens: '.') last asLowercase.
extension = 'html' ifTrue: [ ^'text/html' ]. extension = 'htm' ifTrue:[ ^'text/html' ]. extension = 'txt' ifTrue: [ ^'text/plain' ]. extension = 'gif' ifTrue: [ ^'image/gif' ]. extension = 'jpg' ifTrue: [ ^'image/jpeg' ]. extension = 'jpeg' ifTrue: [ ^'image/jpeg' ]. extension = 'xbm' ifTrue: [ ^'image/x-xbitmap' ].
extension = 'mid' ifTrue: [ ^'audio/midi' ].
^self defaultContentType! !
William Cattey wdc@mit.edu wrote:
This is a multi-part message in MIME format. --------------BE7B82566A9F4394CD619441 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
I hope I'm not gonna embarass myself too much publicly circulating my first real Smalltalk subclass.
This subclass teaches ImageReadWriter to read X bitmaps. This would be useful, for example, if you used Scamper to look at an MIT home directory through our school-wide web.mit.edu. For Example: http://web.mit.edu/wdc/www/.
The MIT web server pushes back a bunch of pretty file icons that are in X bitmap format that Scamper, until now, just complained about.
Here is the class definition. I'd welcome any off-list replies telling me style things I should do differently, or code improvements.
Special thanks to Paul Boutin who wrote the X Bitmap Parser in C for the Andrew Toolkit when he worked for me ~5 years ago. I used his most excellent code as the basis for this work, and to show me how to do X Bitmap parsing.
-wdc
squeak-dev@lists.squeakfoundation.org