[Seaside-dev] Issue 26 in seaside: MimeDocument should be part of Seaside

codesite-noreply at google.com codesite-noreply at google.com
Thu Mar 6 08:32:17 UTC 2008


Issue 26: MimeDocument should be part of Seaside
http://code.google.com/p/seaside/issues/detail?id=26

New issue report by renggli:
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
! !



Issue attributes:
	Status: Accepted
	Owner: ----
	Labels: Type-Defect Priority-Medium

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


More information about the seaside-dev mailing list