[squeak-dev] The Trunk: Morphic-mt.2002.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Jun 8 08:56:37 UTC 2022
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.2002.mcz
==================== Summary ====================
Name: Morphic-mt.2002
Author: mt
Time: 8 June 2022, 10:56:32.803735 am
UUID: 9d283036-ade4-804e-aecb-f285ad9056f0
Ancestors: Morphic-mt.2001
Removes hard dependency to WebClient.
=============== Diff against Morphic-mt.2001 ===============
Item was added:
+ ----- Method: AnimatedImageMorph class>>fromUrl: (in category 'instance creation') -----
+ fromUrl: aUrl
+
+ ^ self new fromUrl: aUrl!
Item was changed:
----- Method: AnimatedImageMorph>>fromUrl: (in category 'initialization') -----
fromUrl: aUrl
+
+ | client response |
+ client := self environment classNamed: #WebClient.
+ self flag: #todo. "mt: Use AppRegistry to download stuff from the Internet."
+ client ifNil: [ self error: 'No WebClient installed' ].
+ response := client httpGet: aUrl.
+ (response code = 200) not ifTrue: [ self error: 'Bad URL or response' ].
+ ((response headerAt: 'Content-Type') = 'image/gif') not
+ ifTrue: [ self error: 'Url does not respond with a gif, but a ', (response headerAt: 'Content-Type')].
+ ^ self fromStream: response content asByteArray readStream.!
- | request |
- request := WebClient httpDo: [ :client | client httpGet: aUrl ].
- (request code = 200) not ifTrue: [ Error signal: 'Bad URL or Request' ].
- ((request headerAt: 'Content-Type') = 'image/gif') not
- ifTrue: [ Error signal: 'Url does not respond with a gif, but a ', (request headerAt: 'Content-Type')].
- ^ self fromStream: request content asByteArray readStream.!
More information about the Squeak-dev
mailing list
|