'From Squeak3.9.1 of 2 March 2008 [latest update: #7075] on 23 July 2008 at 11:11:35 pm'! Site subclass: #STStreamSite instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Stream-Test'! !STStreamSite methodsFor: 'serving' stamp: 'pmm 7/23/2008 22:43'! answerTo: aHTTPRequest ^aHTTPRequest isPost ifTrue: [ self doPost: aHTTPRequest ] ifFalse: [ self doGet: aHTTPRequest ]! ! !STStreamSite methodsFor: 'serving' stamp: 'pmm 7/23/2008 23:10'! doGet: aHTTPRequest ^HTTPResponse ok entity: ' Upload
'! ! !STStreamSite methodsFor: 'serving' stamp: 'pmm 7/23/2008 23:10'! doPost: aHTTPRequest | stream | aHTTPRequest postDataAt: 'file' beforeStreamingDo: [ :datum | stream := (SpFilename named: datum filename) writeStream. datum writeStream: stream ]. aHTTPRequest ensureFullRead. "to be sure streaming occurs" stream close. "mandatory, to close open stream!! " ^HTTPResponse ok! ! !STStreamSite methodsFor: 'serving-private' stamp: 'pmm 7/23/2008 22:39'! helpResolve: aResolution (self canAnswer and: [ aResolution siteMatch: self ]) ifFalse: [^nil]. ^self answerTo: aResolution request! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! STStreamSite class instanceVariableNames: ''! !STStreamSite class methodsFor: 'as yet unclassified' stamp: 'pmm 7/23/2008 22:59'! start | site | site := SwazooServer singleton siteAnyHostAllInterfacesOnPort: 9090. site isNil ifTrue: [ site := (self newNamed: 'streamdemo') host: '*' ip: '*' port: 9090 ]. site start! ! !STStreamSite class methodsFor: 'as yet unclassified' stamp: 'pmm 7/23/2008 22:58'! stop "Stops all sites" SwazooServer stop! !