[Seaside] Magritte + Comet problem?

John Chludzinski john.chludzinski at gmail.com
Wed Jun 3 19:18:45 UTC 2009

To use Comet I use:

      WAListener startOn: 8080.

But it appears that Magritte doesn't work with WAListener.  To get it
to work Bob Arning & I made mods to WAListener (let me know anyone if
this is problematic?):

!WAListener methodsFor: 'private' stamp: 'raa 6/3/2009 14:42'!
convertFileName: aString
	^aString! !

!WAListener methodsFor: 'private' stamp: 'raa 6/3/2009 14:42'!
convertRequest: aKomRequest
	| request |
	self processMultipartFields: aKomRequest.

	request := WARequest
		method: aKomRequest method
		url: aKomRequest url unescapePercents
		headers: aKomRequest header
		fields: (self fieldsOf: aKomRequest)
		cookies: aKomRequest cookies
		nativeRequest: aKomRequest.

	aKomRequest method = 'PUT'
		ifTrue: [request fields
					at: 'PUTData'
					put: (aKomRequest stream next: aKomRequest contentLength)].
	^ request! !

!WAListener methodsFor: 'as yet unclassified' stamp: 'raa 6/3/2009 14:42'!
convertMultipartFileField: aChunk

	^(WAFile fromChunk: aChunk)
		fileName: (self convertFileName: aChunk fileName);
		contentType: aChunk contentType
		yourself! !

!WAListener methodsFor: 'as yet unclassified' stamp: 'raa 6/3/2009 14:42'!
processMultipartFields: aRequest

	aRequest multipartFormFieldsDo: [ :chunk |
		| contents fieldName previousValue |
		fieldName := chunk fieldName.
		contents := chunk fileName isEmptyOrNil
			ifTrue: [
				String streamContents: [ :stream |
					chunk saveToStream: stream ] ]
			ifFalse: [ self convertMultipartFileField: chunk ].
		previousValue := aRequest postFields at: fieldName ifAbsent: [ nil ].
		previousValue isNil
			ifTrue: [  aRequest postFields at: fieldName put: contents ]
			ifFalse: [
				(previousValue isKindOf: self collectionClass)
					ifTrue: [ previousValue add: contents ]
					ifFalse: [ aRequest postFields at: fieldName put: (self
collectionClass with: previousValue with: contents) ] ] ]! !

More information about the seaside mailing list