AW: [Seaside] Images in a CSS style library
David Röthlisberger
davidroe at bluewin.ch
Thu Apr 28 14:18:03 CEST 2005
Hello,
> loadStaticDocuments
>
> Smalltalk at: #StaticDocumentsRepository put: Dictionary new.
>
> (FileDirectory on: (FileDirectory default fullPathFor:
> 'resources')) fileNames
> do: [ :fileName | self loadStaticDocument: fileName ].
>
>
> loadStaticDocument: fileName
>
> | path |
> path := (FileDirectory default fullPathFor: 'resources'),
> FileDirectory slash, fileName.
>
> StaticDocumentsRepository at: fileName
> put: (FileStream readOnlyFileNamed: path) binary
> contentsOfEntireFile.
Thanks.
Basically I do the same as you and pass a byte array to the HttpResponse:
(HttpResponse fromStream: img readStream contentType: 'image/png').
img is a ByteArray with the data of the image.
But I get an error when I try to access such an image in the browser:
Strings only store characters.
I use KomHttpServer 6.2 which uses SocketStreams. Now HttpAdaptor tries to
store this ByteArray into the writeStream of the SocketStream, but this
write stream is created with a String as the collection, so a ByteArray
cannot be stored in this SocketStream. Too bad...
Do you use another version of KomHttpServer? I tried 6.1 too, but this does
not work in a Squeak 3.7 image, i guess...
David
More information about the Seaside
mailing list