[vwnc] [Seaside] WAHtmlRoot>>writeHeadOn: broken when there is no request

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] [Seaside] WAHtmlRoot>>writeHeadOn: broken when there is no request

Boris Popov, DeepCove Labs (SNN)
The fix to avoid writing extra head elements for Ajax requests assumes
that rendering happens in response to a request, which might not always
be the case, especially if you use seaside rendering facilities for any
kind of report generation and such on the server.

Current,

writeHeadOn: aDocument
        aDocument nextPutAll: docType.
        aDocument openTag: 'html' attributes: htmlAttrs.
        aDocument openTag: 'head' attributes: headAttrs.
        WACurrentSession value currentRequest isXmlHttpRequest ifFalse:
[
                self
                        writeElementsOn: aDocument;
                        writeStylesOn: aDocument;
                        writeScriptsOn: aDocument ].
        aDocument closeTag: 'head'.
        aDocument openTag: 'body' attributes: bodyAttrs
       

Workaround,
       
writeHeadOn: aDocument
        | req |
        aDocument nextPutAll: docType.
        aDocument openTag: 'html' attributes: htmlAttrs.
        aDocument openTag: 'head' attributes: headAttrs.
        req := WACurrentSession value currentRequest.
        (req isNil or: [req isXmlHttpRequest not])
                ifTrue:
                        [self
                                writeElementsOn: aDocument;
                                writeStylesOn: aDocument;
                                writeScriptsOn: aDocument].
        aDocument closeTag: 'head'.
        aDocument openTag: 'body' attributes: bodyAttrs.

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc