[Seaside] Usage of WAIframeTag
Lukas Renggli
renggli at gmail.com
Wed Aug 9 14:53:09 UTC 2006
> I arrived at the code below after much trial and error (and I'm
> not sure I know what it does) -- it works but it's very different
> to your solution (and more complicated to boot). What does it actually
> do at all/differently/wrong? Was that the completely wrong way to attack
> the problem?
>
> WAIframeTag>>document: anObject mimeType: aMimeString fileName: aFileNameString
> | key |
> key := html callbacks registerActionCallback:
> [self session
> returnResponse: (Seaside.WADocumentHandler
> document: anObject
> mimeType: aMimeString
> fileName: aFileNameString) response].
> self src: (html context actionUrl withParameter: key) asString
As you observed, your code doesn't do exactly the same thing. You are
registering a new callback every time the page is rendered, therefor
the link changes and cannot be cached by the browser. Actually this is
a good technique, say if you generate your PDF dynamically and only
want to build it (within the callback) when it is actually accessed.
My solutions creates a document handler with a unique URL that won't
change as long as your document doesn't change. The document will be
downloaded by the browser only once and then put into its cache. If I
am not completely mistaken, the document handler will be part of the
application, so it is shared among all sessions.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch
More information about the Seaside
mailing list