[Seaside-dev] About mimeDocumentClass
Lukas Renggli
renggli at gmail.com
Thu Mar 6 08:31:40 UTC 2008
I totally agree. Thanks for providing the implementation.
I added it as: http://code.google.com/p/seaside/issues/detail?id=26
On 3/6/08, Paolo Bonzini <bonzini at gnu.org> wrote:
> Why should the platform support module provide a MIME document class?
> IMO a minimal implementation should be present in the form of a
> WAMIMEDocument class within Seaside-Core, like it's done with URLs and
> MIME types; then, platform support is free to return another class if it
> is polymorphic with WAMimeDocument.
>
> Here is my super-basic implementation:
>
>
> Object subclass: #WAMimeDocument
> instanceVariableNames: 'contentStream content contentType'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Seaside-Core-HTTP'!
>
> !WAMimeDocument class methodsFor: 'instance creation'!
>
> contentType: mimeType content: content
> ^self new contentType: mimeType contentStream: nil content: content
> !
>
> contentType: mimeType contentStream: stream
> ^self new contentType: mimeType contentStream: stream content: nil
> ! !
>
> !WAMimeDocument methodsFor: 'basic'!
>
> asMIMEDocument
> ^self
> !
>
> asMIMEDocumentType: type
> type toString = contentType toString ifTrue: [ ^self ].
> ^self class new
> contentType: type contentStream: contentStream content:
> content
> ! !
>
> !WAMimeDocument methodsFor: 'initialization'!
>
> contentType: mimeType contentStream: stream content: anObject
> contentType := mimeType.
> contentStream := stream.
> content := anObject
> ! !
>
> !WAMimeDocument methodsFor: 'accessing'!
>
> contentStream
> contentStream isNil ifTrue: [ ^content readStream ].
> ^contentStream
> !
>
> contentType
> ^contentType
> !
>
> content
> contentStream isNil ifFalse: [ ^contentStream contents ].
> ^content
> ! !
>
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the seaside-dev
mailing list